The Italians, Danilo Calonego, 66, and Bruno Cacace, 56, and Canadian Frank Poccia were freed during the night "due to the effective cooperation with local Libyan authorities," it said in a statement.
The three men were kidnapped on September 19 in Ghat, close to the Algerian border, where they worked for an Italian company that carried out maintenance at the airport. An armed group blocked their vehicle and took them hostage.
Italian Prime Minister Matteo Renzi praised Libyan security forces and expressed his "sincere gratitude for the solidarity" shown by several mayors in the south of Libya. Italy's foreign ministry said the three arrived in Italy at around 3am (0200 GMT).
In Rome, where prosecutors had opened an investigation into a suspected terrorist kidnapping, a magistrate debriefed the three men for seven hours, according to the Italian AGI news agency.
They said they had been well-treated and that their captors were most likely common criminals with no religious or terrorist affiliations, the agency reported.
Several Italian companies are present in Libya, a former colony, and their expatriate staff have often fallen prey to kidnappers in recent years.
In July 2015, four Italians working for a construction company were kidnapped near an oil field operated by Italian oil giant ENI in the region of Mellitah, west of Tripoli.
Two of the hostages were killed more than six months into their ordeal, likely in clashes between jihadists and local militiamen.
The other two were freed in March this year, in a raid on Islamic State group hideouts near the capital. Chaos has engulfed Libya since the 2011 NATO-backed ouster of dictator Moamer Kadhafi.