Mr Rouhani’s comments came after Donald Trump said he wanted to fix the “terrible flaws” of the agreement and threatened to pull the US out of the pact.
But in a speech broadcast live on state TV, Mr Rouhani said: “The American administration has failed to undermine the nuclear deal … Trump, despite his repeated efforts, has failed to undermine the accord.”
He added: “The deal is a long-lasting victory for Iran.”
A signature foreign policy achievement of Barack Obama‘s presidency, the 2015 nuclear deal struck between Iran and six world powers – the US, UK, Russia, France, China, and Germany.
It lifted crippling economic sanctions on Iran in return for limitations to the country’s nuclear energy programme.
The international powers feared Iran would use to create a nuclear weapon.
President Trump has repeatedly claimed that the deal was too lenient and that Iran had broken parts of the agreement.
He agreed to waive sanctions against Iran for the last time last week, to give the US and European allies a final chance to amend the pact.
The ultimatum has put pressure on European countries who backed the 2015 international agreement and want the pact strengthened with a separate agreement within 120 days.
Iran has said the original deal is non negotiable and it will stick to the accord as long as the other signatories respect it.
It nonetheless threatened to “shred” the deal if Washington pulls out.
Major powers have yet spoken out in favour of implementing the nuclear deal under which Iran agreed to curb its nuclear programme in exchange for lifting of most sanctions.
World news in pictures
China has pledged to continue playing a constructive role in maintaining the deal following President Trump’s ultimatum to fix what he called “significant flaws”.
Chinese Foreign Minister Wang Yi told Iranian Foreign Minister Mohammad Javad Zarif by phone that implementation of the deal had not been “derailed” but would face “some new complicating factors”, the state news agency Xinhua reported.
He also urged Iran to remain calm and continue to fulfil its obligations under the deal.
Additional reporting by Reuters.