Millions of Iranians had followed the talks closely for months with the anticipation that a deal would allow the economy, battered by years of sanctions, to stabilise and make their daily lives easier.
Some small celebrations broke out in the streets as soon as the deal was announced. Bigger parties were expected later in the cool of the evening, after the breaking of the Ramadan fast.
A news conference announcing the deal achieved in marathon talks in Vienna was broadcast live on state TV. So was a speech by U.S. President Barack Obama, an event almost inconceivable until recent months. Iranians gathered around TVs at home and in shops to watch it.
"This is a first step to becoming a friend with the world," Bahar Ghorbani, 36, a housewife who lives in Isfahan said.
"I think the biggest achievement of the nuclear deal is the victory of logic and dialogue over warmongering and violence," she said, contacted over Facebook.
The deal will mean an end to sanctions which have caused economic hardship, particularly over the past three years when Tehran was stripped of access to the international financial system, making it difficult to sell oil and pay for imports.
It was a triumph for President Hassan Rouhani, a pragmatist elected overwhelmingly two years ago on a promise to reduce the isolation of the country of nearly 80 million people.
"Today is the end to acts of tyranny against our nation and the start of cooperation with the world," Rouhani said in a televised address. "If they stick to it, we will. The Iranian nation has always observed its promises and treaties."
Voters who backed him said they now felt vindicated.
"Now people can see the result of their votes," Behrouz Janfada, head of an IT department at an education institute, told Reuters from Tehran. "Rouhani promised to solve the nuclear issue in his electoral campaign, people elected him and he managed to save Iran from the sanctions and the threat of a war. That brings hope, and the feeling that you have a say."
"DEATH TO AMERICA" JUST LAST WEEK
Hatred towards the United States remains a basic tenet of Iran's ruling system, on display just last week during an annual protest day that saw large crowds across Iran chanting "Death to America" and "Death to Israel".
Hardliners expressed doubt about the nuclear deal and had reservations about celebrations by reformists.
"This issue that a nuclear celebration will be taken over by only one faction will cause splits in society," said Hojatoleslam Hossein Sobhaninia, a senior cleric and parliamentarian, in an interview with the Fars News agency.
A police spokesman in Tehran said authorities would not intervene in any celebrations as long as no laws or religious morals were being violated.
Supreme Leader Ayatollah Ali Khamenei has endorsed the negotiations but has yet to speak about the deal itself.
Abbas Abdi, one of Iran's most influential reformist politicians, told Reuters by telephone he did not mind suspending much of Iran's nuclear work to reach out to the world.
"The important part for me is that Iran has came to a mutual understanding with the world, and is not humiliated," said Abdi, one of the students who attacked the U.S. embassy in Tehran in 1979 and held 52 diplomats hostage for 444 days, a crisis that ended the relations of the two countries.
But not everyone was keen to party. Nassim, a 42-year-old graphic designer who said he struggled to make ends meet as an artist, said he would not celebrate until he saw improvements in his own life.
"I didn't go to the streets. It's like World Cup celebration. What's in it for me?" he said. "Tehran's streets are full of expensive convertible cars. That's the effect of sanctions. Those who had money got richer, and the poor are still poor and will remain poor."