A Chinese-American detained in Iran in 2016 and later charged for spying was freed and an imprisoned Iranian was released by Washington in return, and both were flown to their countries, an Iranian official said on Saturday.
The official spoke shortly after Iran's foreign minister said the prisoner swap of Iranian Massoud Soleimani and Chinese-American Xiyue Wang was imminent.
"Glad that Professor Massoud Soleimani and Mr Xiyue Wang will be joining their families shortly. Many thanks to all engaged, particularly the Swiss government," Mohammad Javad Zarif tweeted.
Switzerland represents US diplomatic interests in Iran since Washington and Tehran cut diplomatic ties shortly after the 1979 Islamic Revolution in Iran.
Hua Qu, Wang's wife, confirmed her husband had been released.
"Our family is complete once again. Our son Shaofan and I have waited three long years for this day and it's hard to express in words how excited we are to be reunited with Xiyue," she said in a statement.
"We are thankful to everyone who helped make this happen."
Wang, a US citizen and Princeton University graduate student, was conducting dissertation research in Iran in 2016 when he was detained and accused by Iran of "spying under the cover of research," an allegation his family and the university deny.
He was subsequently convicted on espionage charges and sentenced to 10 years in prison in 2017.
Soleimani, a stem cell expert, was arrested at Chicago airport in October 2018 for allegedly attempting to export biological materials to Iran in violation of US sanctions on Iran over its nuclear program.
Washington has demanded Iran release the Americans it is holding, including father and son Siamak and Baquer Namazi; Michael R. White, a Navy veteran imprisoned last year, and Robert Levinson, a former FBI agent missing since 2007.
Several dozen Iranians are being held in US prisons, many of them for breaking sanctions.
Tensions have heightened between Iran and the United States since Trump last year pulled Washington out of a 2015 nuclear deal between Iran and six major powers and reimposed sanctions that have crippled Tehran's economy.
In return, Iran has gradually scaled back its commitments to the agreement.