Libyan authorities handed the journalists to Turkish diplomats in the capital, Tripoli, on Monday. Turkey says it helped to secure the release of the four and expects them to leave Libya within hours.
The released journalists include New York Times Beirut bureau chief Anthony Shadid, photographers Tyler Hicks and Lynsey Addario, and videographer Stephen Farrell.
The newspaper says the four were detained last Tuesday while covering the conflict between government and rebel forces in the eastern town of Ajdabiya. It says they had crossed from Egypt into the rebel-controlled eastern region of Libya without visas, like many other Western journalists.
Several foreign journalists have been detained or gone missing in Libya since February 15, when the uprising against Libyan leader Moammar Gadhafi began.
Among the missing are two journalists with the French news agency, AFP, and a photographer accompanying them.
AFP said Sunday its reporter Dave Clark and photographer Roberto Schmidt were last in contact on Friday night, when they sent an email saying they planned to travel to an area 35 kilometers outside the eastern city of Tobruk.
AFP said the two journalists were accompanied by Joe Raedle, a photographer for the Getty Images agency. It said the three planned to meet opponents of Gadhafi and speak with refugees fleeing the fighting.
On Sunday, Qatar-based television network Al Jazeera said Libyan authorities arrested four of its journalists who had been working in western Libya. The network said “regional parties” are helping to secure their release.