Mohammad Javad Zarif’s warning comes after the US President threatened to unilaterally pull out of the deal, formally named the Joint Comprehensive Plan of Action (JCPOA), if it is not revised.
Trump has before dismissed the deal as “the worst and most one-sided transaction Washington has ever entered into”.
Mr Zarif said: "Considering what has been envisaged in the JCPOA in the field of research and development and the Islamic Republic of Iran's continued measures to develop its peaceful nuclear capability, if the US makes the mistake of exiting the JCPOA, it will definitely be a painful mistake for the Americans.
“It has been fully foreseen in the JCPOA what measures the Islamic Republic of Iran would carry out if it cannot reap the agreement's economic benefits.”
Mr Zarif’s words have come amid reports Trump’s decision to fire US Secretary of State Rex Tillerson and replace him with Mike Pompeo could have major implications for the the future of the Iran deal.
As CIA chief Mr Pompeo has steered clear of calls to scrap the landmark 2015 deal with Iran, which puts restrictions on its nuclear programme in exchange for the lifting of some sanctions.
He told the Foundation for Defence of Democracies last year: “We need even more intrusive inspection.
“The deal put us in a marginally better place with respect to inspection.
“But the Iranians have on multiple occasions been capable of presenting a continued threat through covert efforts to develop their nuclear program along multiple dimensions, right?
"The missile dimension, the weaponisation effort, the nuclear component itself."