Their return to the US marks the end of a years-long push by Washington to secure the deal with its adversary Tehran.
A plane sent by mediator Qatar flew the five citizens and two of their relatives out of Tehran soon after both sides received confirmation that the funds had been transferred to accounts in Doha.
They spent a few hours in Doha, where the US ambassador welcomed them with hugs on the tarmac at the airport.
“Siamak Namazi, Morad Tahbaz, Emad Sharghi and two citizens who wish to remain private will soon be reunited with their loved ones after enduring years of agony, uncertainty and suffering,” US President Joe Biden said.
“As we celebrate the return of these Americans, we also remember those who did not return.”
Mr Biden also had an "emotional call" with the families of the American citizens who are returning home, the White House said. Each family member who joined the call spoke with him.
Iran's Foreign Ministry said earlier that the prisoner swap would take place once the frozen funds had been released. Funds held in South Korea were expected to be in Iran's possession on Monday, ministry spokesman Nasser Kanaani said.
Mr Biden called on Iran to confirm the fate of Robert Levinson, an American who was taken into custody in 2007 and whom the US believes died in prison before 2020.
“The Levinson family deserves answers,” the US President said as he announced new sanctions against former president Mahmoud Ahmadinejad and the Iranian Ministry of Intelligence for their involvement in wrongful detentions.
Mr Namazi, who was held from 2015 to 2023 at Iran's notorious Evin prison, issued a statement thanking those involved in his release.
“For almost eight years, I have been dreaming of this day,” Mr Namazi said.
“Now that it is finally here, I find my ineffable joy of my forthcoming reunification with my family is laced with sorrow – a painful and deep feeling of guilt for taking my breaths in freedom while so many courageous individuals that I love and admire continue languishing behind those walls.”
The former detainee described his time in Evin, saying that he experienced “the worst of humanity every day” and that his captors “epitomised the baseness of humanity.”
He paid homage to fellow inmates and said the Iranian regime “revels in the endless depth of its gratuitous cruelty”.
White House National Security spokesman John Kirby said the deal did not signal improved ties with Tehran and confirmed that the US had hit Iran with new sanctions.
“We secured this deal simply … to get these five Americans home. It was not orchestrated as some way of a rapprochement with [Tehran],” Mr Kirby told CNN.
Mr Kirby said that of the five Iranians who had been held in the US, only two would return home. Two others were expected to stay in the US, and the fifth was going to a third country.
Secretary of State Antony Blinken, who spoke to the released Americans by phone after they landed in Doha, said the Biden administration had “no higher priority” than freeing US citizens.
“It's very good to be able to say that our fellow citizens are free,” Mr Blinken told reporters in New York, where he and Mr Biden are taking part in UN meetings.
The prisoner swap has been heavily criticised by Republican politicians who claim Iran could use the unfrozen $6 billion to fund its weapons programmes or to support proxy groups fighting in other countries.
Mr Kirby said Iran will not be able to “get hands on this money” but could request withdrawals for humanitarian goods, whose supply would then be overseen through US-managed contracts.
If the money is seen to being used for other reasons, the US can “lock it back down”, he added.
Families of Americans wrongfully detained abroad gather in Washington – in pictures
The announcement came as Iran's President Ebrahim Raisi left for the US, where he will attend the UN General Assembly in New York.
Mr Tahbaz's daughter previously told The National she was “ecstatic” over her father's release but remained fearful of what comes next.
Mr Tahbaz, an environmentalist who also has a British passport, was excluded from a deal last year in which Nazanin Zaghari-Ratcliffe and Anoosheh Ashoori returned to the UK after years in Evin prison.
British Prime Minister Rishi Sunak welcomed his release.
“By seeking to use foreign nationals as bargaining chips, the regime’s leaders are fatally undermining Iran’s credibility on the world stage. They must stop using foreign nationals for political bargaining," Mr Sunak said.
According to Tehran, the Iranians freed by the US include Reza Sarhangpour and Kambiz Attar Kashani, both accused of breaching US sanctions.
A third prisoner, Kaveh Lotfolah Afrasiabi, was detained at his home near Boston in 2021 and charged with being an Iranian government agent, according to US officials.
The two others, Mehrdad Moein Ansari and Amin Hasanzadeh, were said to have links to Iranian security forces.
Tehran confirmed the prisoner swap this month, after the US issued a blanket waiver for international banks to transfer the frozen Iranian funds to Qatar without fear of US sanctions.
But there are still an unknown number of Americans detained in Iran.
The son of Shahab Dalili, a US citizen jailed in Iran, recently underwent a hunger strike outside the White House to protest against his father's exclusion from the deal.
Mr Dalili also began a hunger strike in Evin prison.
“When news broke out on Thursday that there's a deal that is being done and my dad is not in it, that was the trigger for me,” his son Darius told The National.