Matthew Todd Miller and Kenneth Bae are now on their way home.
Director of National Intelligence James Clapper travelled to North Korea and is accompanying the men back, the US has confirmed.
A third US citizen, Jeffrey Fowle, was freed last month and no Americans are now being held in North Korea.
President Barack Obama said he was “grateful” for their safe return.
He said it was “a wonderful day” for the men and their families.
The US had accused North Korea of using its citizens as pawns in a diplomatic game. Pyongyang denies the accusations.
James Clapper travelled to North Korea for direct talks with the authorities.
Barack Obama said: “I appreciate the director doing a great job on what was obviously a challenging mission.”
The US department of state said in a statement that it “welcomes the release of US citizens Kenneth Bae and Matthew Todd Miller from the DPRK [North Korea], where they have been held for two years and seven months, respectively”.
It added: “The United States has long called on DPRK authorities to release these individuals on humanitarian grounds. We join their families and friends in welcoming them home.”
One US official told Associated Press news agency that nothing was offered in return for the releases.
The official said that the releases had not changed the US view of North Korea’s nuclear program and that the North should show a serious commitment to denuclearization and improved human rights.
The US thanked Sweden, which serves as the US protecting power in North Korea, for its efforts in the releases.
Matthew Todd Miller, 24, had been sentenced to six years’ hard labor in September for what North Korean state media described as “hostile acts”.
He had been in custody since April 10 when, according to North Korean sources, he destroyed his tourist visa and demanded asylum.
Kenneth Bae, 42, had been arrested in November 2012 as he entered the north-eastern port city of Rason, a special economic zone near North Korea’s border with China.
He has been described as both a tour operator and Christian missionary. North Korea said he used his tourism business to form groups to overthrow the government.
Kenneth Bae was sentenced to 15 years’ hard labor in May 2013.
DYfPrbnse6oImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…