Hassan Rouhani's comments came as President Donald Trump appears to be stepping back from his campaign pledge to tear up the deal, instead aiming to take other measures against Iran and its affiliates.
State TV broadcast Rouhani while addressing students at Tehran University, marking the beginning of the educational year.
"We have achieved benefits that are irreversible. Nobody can roll them back, neither Trump, nor 10 other Trumps," he said.
Rouhani warned the U.S. not to violate the deal.
"If the United States violates (the nuclear deal), the entire world will condemn America, not Iran," he said.
Iran accepted curbs on its contested nuclear program as part of the agreement. In return, Iran has benefited from the lifting of sanctions against its oil exports among others.
Trump is expected to take new action against Iran's Revolutionary Guard and the Iranian backed Shiite militant group Hezbollah.
He is set to deliver a policy speech on Iran next week in which he is expected to decline to certify Iran's compliance in the landmark 2015 agreement that the U.S. and its partners signed with Tehran to rein in its nuclear program.
That would stop short of pulling out of the deal. Lawmakers say Trump isn't going to immediately announce new nuclear sanctions, which are prohibited by the deal, and instead will refer the matter to Congress.
President Trump has repeatedly described the deal as "bad." He signed a bill that imposes mandatory penalties on people involved in Iran's ballistic missile program and anyone who does business with them.
Rouhani is struggling to keep the deal on two fronts. One is with Trump, who always says it is a bad deal, and on the other side, hardliners inside the country.
By the time of his 2017 re-election, Rouhani increasingly criticized hard-liners within Iran who criticized him and the atomic deal for giving too much away to the West, especially the U.S., still the "Great Satan" for some even decades after the 1979 Islamic Revolution.
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.