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 underway in Vienna as Iran anticipates the lifting of international sanctions as part of the nuclear deal agreed last year.
The US citizens 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.
News of the releases came after Iranian Foreign Minister Javad Zarif predicted that international sanctions against his country would be lifted on Saturday.
He is in Vienna for talks with US Secretary of State John Kerry over Iran’s nuclear deal.