Head of the International Atomic Energy Agency, IAEA, Rafael Mariano Grossi, left, and Iranian Foreign Minister Hossein Amirabdollahian shake hands for the media prior to their meeting, in Tehran, Iran, Tuesday, Nov. 23, 2021. (AP Photo)
But in 2018, then president Donald Trump pulled the United States out of the agreement and reimposed sanctions, prompting Iran to roll back its commitments.
The US and Israel continue to accuse Iran of seeking to build nuclear weapons, a claim it denies.
With talks on restoring the deal set to start in Vienna on Monday, we look back its troubled history.
Negotiations start in June 2013 between Iran and the five permanent members of the UN Security Council -- Britain, China, France, Russia and the US -- plus Germany.
The final deal is reached in July 2015, seemingly ending a 12-year dispute over the Iran nuclear issue.
Stopping the bomb
The accord's goal is to make it practically impossible for Iran to build an atomic bomb, while allowing it to pursue a civilian nuclear programme.
Tehran pledges to reduce its nuclear capacities for several years, capping its enrichment of uranium at 3.67 percent -- sufficient for power generation, but far below the more than 90 percent required for a nuclear weapon.
Iran agrees to slash the number of its enrichment centrifuges from more than 19,000 to 5,060 for a decade.
It also agrees to modify its heavy water reactor in Arak to prevent it from using plutonium for military use.
The deal comes into effect in January 2016.
Inspectors, sanctions relief
The International Atomic Energy Agency is charged with carrying out inspections to ensure Iran is meeting its commitments.
The accord paves the way for a partial lifting of international sanctions on Tehran, opening the door to foreign investors.
However, UN embargoes on the sale of conventional arms and on ballistic missiles to Iran are maintained up to October 2020 and 2023 respectively.
The three European signatories, Britain, France and Germany, have -- like the US -- opposed lifting the embargo on conventional arms.
But the powers insisted they remained committed to the 2015 nuclear deal, and said UN sanctions should not be reimposed.
Investment starts to flow into Iran after the nuclear deal. But in May 2018, Trump pulls the US out of the agreement, calling it "rotten".
Sanctions follow with Washington particularly targeting Iran's oil and finance sectors.
In May 2019, Tehran starts stepping back from the accord, prompting fears it might unravel.