Steve Centanni, a 60-year-old American, and New Zealand-born cameraman Olaf Wiig, 36, were seized on August 14 by a previously unknown group called the Holy Jihad Brigades.
After what was one of the longest detentions for foreign captives in Gaza, television images showed the two men being taken into a hotel by Palestinian security officials on Sunday.
The Holy Jihad Brigades claimed responsibility on Wednesday for the kidnapping and had told the United States to free Muslim prisoners to prevent the captives from facing unspecified consequences.
The United States had rejected the demand and the deadline expired on Saturday.
Khaled Abu Hilal, the Palestinian interior ministry spokesman, said the government had received assurances that the hostages would be freed.
Just before their release, a second video of the pair was issued.
Both journalists appeared to be in good health in the new video.
The two men were shown separately, sitting cross-legged, reading statements announcing that they had converted to Islam.
Centanni said he had embraced
Centanni said: “I changed my name to Khaled. I have embraced Islam and say the word Allah.”
Wiig called on leaders of the West to stop “hiding behind the ‘I don’t negotiate with terrorists’ myth”.
A separate statement from the captors said: “They chose Islam and that is a gift that God gives those whom he chooses.”
Centanni later told CNN by telephone from Gaza City that they felt that they had to convert to Islam.
“I have the highest respect for Islam, but it was something we felt we had to do because they had the guns and we didn’t know what the hell was going on,” he said.
Ismail Haniya, the Palestinian prime minister, said the kidnappers had nothing to do with al-Qaeda nor any known Palestinian groups.
Videos of the captives released by the kidnappers had borne all the hallmarks of hostage tapes shot by fighters in Iraq.
“These are young men who carried out the action out of private beliefs,” Haniya told reporters.
No arrests have been made.
The Hamas-led government had called for the men to be freed while several prominent resistance groups in Gaza denied involvement and also said the men should be freed.