US President Barack Obama said that with the deal, "every pathway to a nuclear weapon is cut off" for Iran.
His Iranian counterpart, Hassan Rouhani, said it opened a "new chapter" in Iran's relations with the world.
The deal reportedly gives UN nuclear inspectors extensive but not automatic access to sites within Iran.
Negotiations between Iran and six world powers - the US, UK, France, China and Russia plus Germany - began in 2006.
The so-called P5+1 want Iran to scale back its sensitive nuclear activities to ensure that it cannot build a nuclear weapon.
Iran, which wants crippling international sanctions lifted, has always insisted that its nuclear work is peaceful.
Mr Obama said that the deal "makes the world safer and more secure", and that it provides for a rigorous verification regime. "This deal is not built on trust - it is built on verification," he said.
EU foreign policy chief Federica Mogherini said the deal was "a sign of hope for the entire world".
"It is a decision that can open the way to a new chapter in international relations," she said, ahead of a final meeting between negotiators in Vienna.