World powers and Iran have formally announced a comprehensive nuclear accord.
Federica Mogherini, the European Union’s foreign policy chief, said: “Today is an historic day.”
She added that it was a great honour “for us to announce that we have reached an agreement on the Iranian nuclear issue”.
Ms Mogherini appeared on stage in Vienna alongside Iranian foreign minister Mohammad Javad Zarif.
She said: “We are creating the conditions for building trust.
“No-one ever thought it would be easy. … Despite twists and turns in the talks, hope and determination enabled us to overcome all the difficult moments.”
She said the deal involves Iran “under no circumstances” obtaining or building nuclear weapons.
US president Barack Obama said every path to a nuclear weapon will be cut off for Iran following the historic agreement.
Mr Obama spoke from the White House immediately after the official announcement of the deal.
Addressing sceptics of the agreement, Mr Obama said: “This deal is not built on trust. It is built on verification.”
He insisted that the accord ensures that Iran “will not develop a nuclear weapon”.
The US leader added that Iran’s compliance will be verified by inspections.
Iranian president Hassan Rouhani said the deal marked “a new chapter” in relations with the world and the Islamic republic.
Speaking in Tehran, Mr Rouhani said: “The sanctions regime was never successful, but at the same time it had affected people’s lives.”
US secretary of state John Kerry said the agreement, which he had spent the last 19 days negotiating for in Vienna, is “the good deal that we sought”.
Throughout nearly two years of talks, US officials have insisted that “no deal is better than a bad deal”.
Mr Kerry said the US and its partners would have finished the negotiations a long time ago had they been willing to settle for a lesser deal.
“We were determined to get this right and I believe our persistence paid off,” Mr Kerry said.
Mr Obama heralded the deal as an opportunity for the long-time foes to move in a “new direction”, while warning US Congress that it would be irresponsible to block the accord.
“No deal means a greater chance of more war in the Middle East,” he said.
Even with the world powers in agreement, Mr Obama must now sell the virtues of the deal to sceptics on Capitol Hill.
US Congress has 60 days to assess the accord and decide whether to pursue legislation imposing new sanctions on Iran or to prevent Mr Obama from suspending existing ones.
The president renewed his vow to veto any such legislation and urged representatives to consider the repercussions of their actions.
He painted a grim scenario in which the rest of the world struck its own nuclear deals with Iran, leaving the US isolated. And without the limitations and verifications included in today’s deal, Mr Obama said he or a future US president would be more likely to face a decision about using US military action to prevent Iran from building a bomb.
The White House is expected to launch a campaign to win support for the deal on Capitol Hill very soon.
The US president is also expected to speak with several world leaders later today.
A spokesman for Iraqi prime minister Haider al-Abadi said the agreement will be “a catalyst for regional stability”.
Saad al-Hadithi said the landmark agreement is “an important step” and will lead to better unity in the fight against terrorism.
A US-led coalition is conducting air strikes in Iraq against Islamic State (IS), while neighbouring Iran provides extensive logistical support on the ground.
Despite their shared interests in defeating IS, coalition nations have not worked directly with Iran, Iraq’s biggest ally, even as negotiations were under way in Vienna.
he deal means Iran will curb its nuclear programme in exchange for billions of dollars in relief from international sanctions.
The accord, which follows 18 days of intense negotiations, is designed to avert the threat of a nuclear-armed Iran and another US military intervention in the Muslim world.
The agreement will keep Iran from producing enough material for a nuclear weapon for at least 10 years and impose new provisions for inspections of Iranian facilities, including military sites.
It also marks a dramatic break from decades of animosity between the US and Iran, countries that alternatively call each other the “leading state sponsor of terrorism” and “the Great Satan”.
Following a final round of talks with counterparts from the US, UK, China, France, Germany and Russia in Vienna, Iranian foreign minister Mohammad Javad Zarif said: “This is a historic moment.
“We are reaching an agreement that is not perfect for anybody, but it is what we could accomplish, and it is an important achievement for all of us.
“Today could have been the end of hope on this issue. But now we are starting a new chapter of hope.”
The formal announcement of the so-called Joint Comprehensive Plan of Action is due to be made after the meeting.
Its completion comes after more than two weeks of often fractious diplomacy, during which negotiators blew through three self-imposed deadlines.
Mr Zarif and US secretary of state John Kerry, who conducted most of the negotiations, both threatened to walk away while trading accusations of intransigence.
The breakthrough came after several key compromises.
Diplomats said Iran agreed to the continuation of a UN arms embargo on the country for up to five more years, though it could end earlier if the International Atomic Energy Agency (IAEA) definitively clears Iran of any current work on nuclear weapons.
A similar condition was put on UN restrictions on the transfer of ballistic missile technology to Tehran, which could last for up to eight more years.
Washington had sought to maintain the ban on Iran importing and exporting weapons, concerned that an Islamic republic flush with cash from the nuclear deal would expand its military assistance for Syrian president Bashar Assad’s government, Yemen’s Houthi rebels, the Lebanese militant group Hezbollah and other forces opposing America’s allies in the Middle East, such as Saudi Arabia and Israel.
Iranian leaders insisted the embargo had to end as their forces combat regional scourges such as IS. They also received some support from China and particularly Russia, which wants to expand military cooperation and arms sales to Tehran, including the long-delayed transfer of S-300 advanced air defence systems – a move long opposed by the US.
Another significant agreement will allow UN inspectors to press for visits to Iranian military sites as part of their monitoring duties, something the country’s supreme leader, Ayatollah Ali Khamenei, had long vowed to oppose.
However, access is not guaranteed and could be delayed, a condition that critics of the deal are sure to seize on as possibly giving Tehran time to cover up any illicit activity.
Under the accord, Tehran would have the right to challenge the UN request and an arbitration board composed of Iran and the six world powers would then decide on the issue.
The IAEA also wants the access to complete its long-blocked investigation of past weapons work by Iran, and the US says Iranian cooperation is needed for all economic sanctions to be lifted.
IAEA chief Yukiya Amano said his agency and Iran had signed a “roadmap” to resolve outstanding concerns.
The economic benefits for Iran are potentially massive. It stands to receive more than 100 billion dollars (£64 billion) in assets frozen overseas, and an end to a European oil embargo and various financial restrictions on Iranian banks.
Mr Zarif said the agreement was a “win-win solution.”
Federica Mogherini, the European Union foreign policy chief, called it “a sign of hope for the entire world”.
The nuclear deal comes after nearly a decade of international, intercontinental diplomacy that until recently was defined by failure.
Breaks in the talks sometimes lasted for months, and Iran’s nascent nuclear programme expanded into one that Western intelligence agencies saw as only a couple of months away from weapons capacity. The US and Israel both threatened possible military responses.
The US joined the negotiations in 2008, and US and Iranian officials met together secretly four years later in Oman to see if diplomatic progress was possible.
But the process remained essentially stalemated until summer 2013, when Hassan Rouhani was elected president and declared his country ready for serious compromise.
More secret US-Iranian discussions followed, culminating in a face-to-face meeting between Mr Kerry and Mr Zarif at the UN in September 2013 and a telephone conversation between Mr Rouhani and US president Barack Obama.
That conversation marked the two countries’ highest diplomatic exchange since Iran’s 1979 Islamic Revolution and the ensuing hostage crisis at the American embassy in Tehran.
Mr Kerry and Mr Zarif took the lead in the negotiations. Two months later, in Geneva, Iran and the six powers announced an interim agreement that temporarily curbed Tehran’s nuclear programme and unfroze some Iranian assets while setting the stage for Tuesday’s comprehensive accord.
It took time to strike the final deal, however. The talks missed deadlines for the pact in July 2014 and November 2014, leading to long extensions.
Finally, in early April, negotiators reached framework deal in Lausanne, Switzerland, setting up the last push for the historic agreement.
Protracted negotiations still lie ahead to put the agreement into practice, and deep suspicion reigns on all sides about violations that could unravel the accord.
Iranian hardliners oppose dismantling a nuclear programme the country has spent hundreds of billions of dollars developing. Khamenei, while supportive of his negotiators thus far, has issued a series of defiant red lines that may be impossible to reconcile in a deal with the West.
Further afield, Israel strongly opposed the outcome. It sees the acceptance of extensive Iranian nuclear infrastructure and continued nuclear activity as a mortal threat, and has warned that it could take military action on its own, if necessary.
The deal is a “bad mistake of historic proportions,” Israeli prime minister Benjamin Netanyahu said, adding that it would enable Iran to “continue to pursue its aggression and terror in the region”.
Sunni Arab rivals of Shia Iran have also signalled their opposition, with Saudi Arabia in particular issuing veiled threats to develop its own nuclear programme.