Washington pulled out of the 2015 nuclear deal between Iran and six world powers in May.
Iran's president boasted Sunday that the United States has lost against the Islamic republic's "righteousness and wisdom" by walking out of the landmark nuclear deal.
"Everyone knows that America has lost legally and politically by giving up on its international obligations and that we have achieved victory," said President Hassan Rouhani in a speech at the University of Tehran to mark the beginning of the school year.
"There are but a few countries in the world that would call the US withdrawal from the JCPOA (nuclear deal) a good move," he added.
"Those that are cautious express disappointment, those that are more frank say it was a mistake, and the outspoken say it was illegal."
Washington pulled out of the 2015 nuclear deal between Iran and six world powers in May and is reimposing punishing sanctions on the country, hoping to pressure Tehran into what President Donald Trump calls a "better deal".
The US is due to complete the reimposition of sanctions on November 5, targeting Iran's oil sector and central bank.
The other parties to the agreement -- Russia, China, the UK, France and Germany -- have all pledged to continue to try to make the deal work, despite their firms being vulnerable to the US sanctions if they keep doing business with Iran.
Rouhani said Iran's response had left Washington "empty-handed".
"They expected us to leave the JCPOA hours after they announced they are, and what would have happened? The case would have returned to the UN Security Council, turned against Iran and isolated us," he said.
He said Iran had lost nothing by staying in the deal and could leave "whenever" it chooses.