Hundreds of thousands of Iranians took to the streets on Monday to mark the 40th anniversary of the 1979 Islamic revolution.
State TV showed crowds defying cold rainy weather and carrying Iranian flags while shouting "Death to Israel, Death to America," with some protesters burning American flags.
The large turnout in state-sponsored rallies came as Iranians face mounting economic hardships following the return of US sanctions last year.
Prices of basic foodstuffs have soared since President Donald Trump withdrew Washington from the 2015 nuclear deal in May 2019.
In a speech at Tehran's Azadi (Freedom) square, Rouhani said US efforts to isolate Iran would fail.
"We will not let America become victorious… Iranian people have and will have some economic difficulties but we will overcome the problems by helping each other," he said.
Rouhani made clear Tehran was determined to expand its military power despite international pressure.
"We have not asked and will never ask anyone for permission to increase our defence capabilities and to build all kinds of missiles, be they surface-to-air missiles, anti-ship missiles or ground-to-ground missiles," the Iranian leader said.
Iran displayed its ballistic missile capabilities during a parade marking the anniversary, including the Zolfaqar, a ground-to-ground missile with a 700 kilometre (435 mile) range and the Qiam, with a range of 800 km, according to Tasnim news agency.
Brigadier General Hossein Salami, the Revolutionary Guards deputy head, said Tehran would not withdraw forces from the region, dismissing US calls for Iranian clout to be curbed.
"The world saw when Iran decided to help people of Syria, Iraq, Lebanon, Palestine and Yemen, they achieved victory. The enemies are now confessing to their defeat," said Rouhani.
Some Iranians criticise their leaders for what they say are foreign adventures which squander funds.