World powers have reached a deal with Iran on limiting Iranian nuclear activity in return for the lifting of international economic sanctions.
Iran's foreign minister called the agreement "historic", saying it opened a "new chapter of hope".
It 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.
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 in comments ahead of a final meeting between negotiators in Vienna.
Iranian Foreign Minister Mohammad Javad Zarif said the deal was "not perfect for anybody'', but that it was the "best achievement possible that could be reached".
Iran's Press TV reported: "Iran has been recognised as nuclear power entitled to fuel cycle and enrichment."
The text of the deal has not been released but these are some of the details it is believed to contain:
A compromise over the inspection of sites within Iran, the Associated Press quotes a diplomat as saying - UN inspectors would be allowed to monitor military sites but Iran could challenge requests for access
Iran has accepted that sanctions could be restored in 65 days if it violates the deal, Reuters cited diplomats as saying
A UN arms embargo and missile sanctions would remain in place for five and eight years respectively, Reuters reports
Sanctions in areas including oil and gas trading, financial transactions, aviation and shipping will be lifted and billions of dollars of Iranian assets unfrozen, Iranian media report
'Significant step forward'
Separately, the International Atomic Energy Agency (IAEA) and Iran said they had signed a roadmap to resolve outstanding issues.
IAEA head Yukiya Amano told reporters in Vienna that his organisation had signed a roadmap "for the clarification of past and present outstanding issues regarding Iran's nuclear programme".
He called the agreement a "significant step forward", saying it would allow the agency to "make an assessment of issues relating to possible military dimensions to Iran's nuclear programme by the end of 2015".
There has been stiff resistance to a deal from conservatives both in Iran and the US.
Israel's government has also warned against an agreement.
Following reports of a deal, Israeli Prime Minister Benjamin Netanyahu said he believed it was a "historic mistake" that would provide Iran with "hundreds of billions of dollars with which it can fuel its terror machine and its expansion and aggression throughout the Middle East and across the globe".