An Egyptian diplomat confirmed the release on Monday of Muhammad al-Gharabawi, a fuel tanker driver who was caught in early July when he was crossing into Iraq from Saudi Arabia.
"He is with me and we are heading to the embassy now," Muhammad Mamduh Kutb, counsellor at Egypt's interests section in Baghdad, told AFP.
"He is in good health."
Kutb refused to say whether a ransom was paid to secure the freedom of Gharabawi after his Saudi employer had announced on Friday that it would end all its activities in Iraq as demanded.
Initially the group that held Gharabawi had demanded a $1m ransom but his employer offered $15,000 instead.
A group calling itself the Khalid bin al-Walid Brigade affiliated to the Iraq Islamic Army claimed responsibility for the capture, one of a spate over the past month.
Threat to behead
The same group had also claimed it was holding a truck driver from the Philippines and threatened to behead him unless Manila withdrew its troops from Iraq by 20 July, one month earlier than scheduled.
The Philippines carried out the demands on Monday as the last 34 members of its tiny 51-member contingent left Iraq one month ahead of schedule in an attempt to save the life of father of eight Angelo de la Cruz.
A convoy of six pick-up trucks carrying the final 34 soldiers and police drove down a military road towards Kuwait, an AFP reporter said.
"All the troops have left today from Iraq to Kuwait on the way to the Philippines," said a senior official from Manila who is in Baghdad as part of a team helping to negotiate the release of the truck driver.
But there was no sign yet of de la Cruz whose fate has gripped the emotions of his countrymen for the past two weeks.
Manila went ahead with its decision despite sharp rebukes from Iraq and the United States which fear a backlash.