The release of 63-year-old Francesco Scalise and 52-year-old Luciano Gallo gave "great joy and satisfaction," foreign minister Emma Bonino said in a statement.
Scalise and Gallo were taken hostage in an area beyond Libyan authorities' control and were rescued in an operation "thanks to collaboration between Libyan and Italian authorities," the foreign ministry said.
The two men, both from Italy's southern Calabria region, were taken hostage in Derna, in Libya's eastern Cyrenaica region on 18 January, according to local media. They were snatched from a minibus as it travelled through a remote area, the reports said.
They men had been in Libya for five months, where they were working for the company General Works, building a road.
Libya is a former Italian colony and the Italian cemetery in Tripoli was attacked twice last month, leaving one guard dead and several graves damaged.
There have been a spate of recent attacks on foreigners in Libya, where militia and armed gangs still control large parts of the country since the 2011 war that toppled longtime strongman Muammar Ghaddafi