"The presence of people today on the streets all over Islamic Iran. means that the enemy will never reach its evil objectives", a defiant President Hassan Rouhani told those thronging Tehran´s Azadi (Freedom) Square, decrying a "conspiracy" involving Washington.
Iran displayed its ballistic missile capabilities during a parade, including the Zolfaqar, a ground-to-ground missile with a 700 km (435 miles) range and the Qiam, with a range of 800 km, according to Tasnim news agency.
The large turnout in state-sponsored rallies came as Iranians face rising prices, food shortages and high inflation that have triggered waves of protests.
Hundreds of thousands of Iranians gathered Monday to mark the 40th anniversary of the country's Islamic Revolution.
There's also a huge display of domestically-developed military equipment, including drones, missiles, bombs, and weapons.
Ahead of the celebrations, Iranian officials announced that up to 50,000 prisoners would either be released or have their sentences reduced.
In a speech at Tehran's Azadi square, President Hassan Rouhani dismissed US efforts to isolate Iran, saying USA sanctions could not break the Islamic Republic.
He also blasted a US "conspiracy" against the country, saying, "The presence of people today on the streets all over Islamic Iran. means that the enemy will never reach its evil objectives".
"The Iranian people have and will have some economic difficulties (due to the sanctions) but we will overcome the problems by helping each other", Rouhani said.
"The United States does not have the courage to shoot a single bullet at us despite all its defensive and military assets".
But if the U.S. does attack, he warned, "We will raze Tel Aviv and Haifa to the ground".
Israeli Prime Minister Benjamin Netanyahu dismissed the threat.
Referring to Iran as "the Mother Land", Rouhani said that during the rule of "the traitor Qajar dynasty 205 years ago", large portions of lands were separated from Northern Iran and the caucuses. They saw the revolution as the starting gun in a competition to push out the strongman Arab nationalism that had taken hold across the Middle East.
Netanyahu's comments came in response to a threat made by Yadollah Javani, the Guard's deputy head for political affairs, who said at a rally celebrating the 40th anniversary of the Islamic revolution that the United States "does not have the courage to shoot a single bullet at us despite all its defensive and military assets".
Iran also has vast clout in Iraq, where Major-General Qassem Soleimani, head of the overseas arm of the Revolutionary Guards, was frequently photographed guiding Shi'ite militias in the war against Sunni Islamic State militants.