Iran has released Washington Post reporter Jason Rezaian and three other Iranian-American prisoners in an apparent prisoner swap with the US.
Rezaian, 39, was jailed on charges, including espionage, last November.
The US said it was offering clemency to seven Iranians being held in the United States for sanctions violation.
Diplomatic talks are under way in Vienna as Iran anticipates the lifting of international sanctions as part of the nuclear deal agreed last year.
News of the releases came after Iranian Foreign Minister Javad Zarif said the sanctions would be lifted on Saturday.
He is in Vienna for talks with US Secretary of State John Kerry over Iran’s nuclear deal.
The US citizens released on Saturday are being flown to Switzerland and will be taken to a US base in Germany for medical treatment.
The other three Americans were named as Saeed Abedini, Amir Hekmati and Nosratollah Khosravi-Roodsari.
A US official said a diplomatic channel was established “with the focus of getting our detained US citizens home”.
“Iran has also committed to continue co-operating with the United States to determine the whereabouts of Robert Levinson,” the official said.
According to the Associated Press news agency, Mr Levinson is a former FBI agent who disappeared in Iran in 2007 while working for the CIA on an unapproved intelligence mission.
A further 14 Iranians sought by the US would be removed from an Interpol wanted list, the US and Iran said.
A fifth American, writer and student Matthew Trevithick, was also released from jail in Iran on Saturday, but his release was not part of the prisoner exchange.
His family said in a statement published on the Iran Primer website that he had been held at Evin prison in Tehran for 40 days. He had been studying languages in Iran, they said.
The international nuclear watchdog, the IAEA, is expected to confirm that Iran has scaled back its atomic activities in line with the agreement.
Billions of dollars of frozen Iranian assets are expected to be released and the sale of Iranian oil on the world market will again be permitted.
Iran’s press anticipates lifting of sanctions
Many newspapers have hailed “good days ahead” for the economy, but the hardline press has lamented nuclear restrictions, with Vatan-e Emruz declaring closing the Arak reactor amounted to a “nuclear burial”.
Moderate Iran and reformist Mardom Salari feared Saudi Arabia and US Republicans would try to sabotage the deal, the latter predicting that “powerful hands will try to boobytrap this path”.
Meanwhile Conservative Hemayat said the nuclear deal would not “resolve the problem with the village chief” – referring to the US – and hardline Keyhan argued that the deal had not led to a let-up in US “anti-Iranian propaganda”.