United States President Donald Trump and Iran's president signed a deal on Wednesday (Jun 17) meant to end the Middle East war, with Tehran agreeing to dilute its enriched uranium in return for large-scale economic relief.

Trump put his signature to the memorandum of understanding during dinner with French President Emmanuel Macron at the Palace of Versailles following a G7 summit, a US official told AFP.

"Just signed it," Trump told reporters as he emerged from the palace.

Iranian Foreign Ministry spokesman Esmaeil Baqaei, quoted by the state news agency IRNA, said the document "was finalised with the signatures of the presidents".

The deal aims to draw a line under the war launched on Feb 28 by the US and Israel, prompting Iran to counterattack with missile and drone salvos across the region - and effectively shutting down the Strait of Hormuz, a crucial waterway for the world economy.

"Now it is time to test the implementation of the agreement," Baqaei said.

Under the text, Washington commits to immediately waive oil sanctions crippling Iran's economy.

And once a final agreement is reached on the Islamic republic's nuclear programme, the US will also facilitate the release of a US$300 billion reconstruction fund supported by regional nations, the deal says.

The agreement had earlier been slated for signatures by Iran's chief negotiator and parliament speaker, Mohammad Bagher Ghalibaf, and US Vice President JD Vance. Iran said an in-person ceremony was no longer needed.

Iran insisted the deal represented a US "failure".

"People will see it and judge," Ghalibaf said on state television late on Wednesday, after the text was released by both sides.

Highlighting the global impact of any deal, China said on Wednesday that its top diplomat had impressed on Tehran that it was "key" for all sides to "genuinely implement" their commitments.

But Trump's decision to pull the plug on the war, in which 13 US service members were killed and vast amounts of US ammunition stockpiles were used up, has unsettled some of his own allies at home.

The agreement is only a temporary arrangement meant to give time for starting detailed negotiations on the far more complex issue of long-term control over Iran's nuclear power ambitions, which Washington has long suspected of harbouring a secret bomb-making programme.