The men had been captured by troops in the embattled eastern city of Benghazi, where former general Khalifa Haftar has launched an offensive against Islamist militants.
A statement from the internationally recognised government said the men were freed in response to a request by the UN mission in Libya (UNSMIL).
The were handed over to Turkey in an operation monitored by UNSMIL chief Bernardino Leon, the statement said.
In June, more than 400 Turks were evacuated from Libya following threats by Haftar, who accuses Ankara of backing his Islamist opponents.
Most of those evacuated had been working at a power station in the city of Sirte, home town of slain dictator Moamer Kadhafi.
Signup to our newsletter and follow us on Facebook and Twitter!
A spokesman for Haftar, Mohamed Hijazi, said "the army released the Turkish nationals after making sure that they were not involved" in fighting that has rocked Benghazi almost daily since May.
Haftar launched an initial offensive against Islamists in Libya's second city in May with no government support, but in October, with Islamist militia influence growing, he launched a new campaign, this time backed by government troops.
Three years after Kadhafi was toppled and killed in a NATO-backed revolt, Libya is awash with weapons and powerful militias, and run by rival governments and parliaments.
Also on Friday, Libya's rival government said it had seized an Airbus A300 at an airport in the oasis town of Ghadames, southwest of Tripoli, because it was carrying "suspicious cargo".
A statement said that seven crew members -- three Russians, two Ukrainians and two Tajiks -- were also detained.
A spokesman for the internationally recognised government, which is based in the east, told AFP the aircraft was carrying "humanitarian aid" for southwestern regions of Libya.