Carter flew to the North Korean capital, Pyongyang, this week on a private mission to secure a pardon for the 31-year-old American.
North Korean leader Kim Jong Il granted Carter's request to "leniently forgive" Gomes, the official Korean Central News Agency reported, and Carter and Gomes were due back in Boston later Friday for a reunion with his mother, Carter's spokeswoman Deanna Congileo said in Atlanta.
There was no indication that Kim - who was making a surprise trip to China this week - met with Carter as widely anticipated.
In Washington, the State Department welcomed the news of Gomes' release. We "are relieved that he will soon be safely reunited with his family," spokesman P.J. Crowley said.
Gomes was the fourth American in a year arrested for trespassing in North Korea, a communist nation that fought against the U.S. during the 1950-53 Korean War and does not have diplomatic relations with Washington.
Journalists Laura Ling and Euna Lee were arrested last March and released only after former President Bill Clinton made a similar trip to Pyongyang to plead for their freedom.
Activist Robert Park deliberately crossed into the country from China in December but was expelled some 40 days later after issuing an apology carried by North Korean state media.
Aijalon Gomes (pronounced EYE-jah-lahn GOHMS), who had been teaching English in South Korea, attended rallies in Seoul in January calling for Park's release. He was arrested in North Korea just two weeks later.
In April, he was sentenced to eight years of hard labor and fined 70 million won - more than $600,000 - for sneaking into the country illegally and committing a "hostile act."
There were concerns about Gomes' health. Last month, North Korean media said Gomes attempted suicide, "driven by his strong guilty conscience, disappointment and despair at the U.S. government that has not taken any measure for his freedom."
A U.S. delegation tried unsuccessfully in a secret visit to Pyongyang earlier this month to secure his release, Crowley said last week.
This week's decision to "set free the illegal entrant is a manifestation of (North Korea's) humanitarianism and peace-loving policy," KCNA said.
On Friday, Gomes looked markedly thin but relieved. He was dressed in a striped polo shirt and slacks in footage from the tarmac aired by broadcaster APTN in Pyongyang.
Footage showed a young North Korean girl giving Carter a snappy salute and a bouquet. Carter returned the salute, gave her a hug and kiss, and paused to pose with her for a photo.
Top North Korean nuclear envoy Kim Kye Gwan and senior diplomat Ri Gun shook Carter's hand and then waved as the plane took off in a drizzling rain.
The Carter Center, the Atlanta-based organization founded by Carter and his wife, Roslynn, and U.S. officials have emphasized that the ex-president's trip was a private humanitarian mission. Still, such visits have in the past provided an opportunity for unofficial diplomacy.
KCNA said Carter met with North Korea's No. 2 official, Kim Yong Nam, who relayed Pyongyang's interest in resuming the six-nation disarmament talks and reiterated the regime's commitment to denuclearization.
Carter and his party also held "an openhearted discussion" with North Korea's foreign minister and the vice foreign minister for U.S. affairs, on their countries' relations as well as denuclearization, the news agency said.
Six-nation nuclear talks have been stalled since North Korea walked away from the disarmament process last year.
Pyongyang, believed to have enough weaponized plutonium for a half-dozen atomic bombs in addition to a uranium-enrichment program, routinely cites the U.S. military and nuclear threat as a main reason behind its need for nuclear weapons.
Washington maintains 28,500 troops in South Korea to protect the longtime ally.
Carter met with Kim's father, late President Kim Il Sung, during a 1994 visit - friendly talks that led to a landmark nuclear disarmament pact.
Associated Press writers Carol Druga in Atlanta and Matthew Lee in Washington contributed to this report.