The Italian foreign ministry announced the release of Marco Vallisa, 54, but provided no details of how he came to be liberated.
But a security source in Libya told AFP Vallisa had been held by "an armed militia" who freed him after they obtained a "ransom of around €1 million."
The source, who declined to be named, did not identify the group but confirmed that Vallisa was on his way home.
Three years after dictator Muammar Qaddafi was toppled and killed in a Nato-backed revolt, Libya is awash with weapons and powerful militias, and run by rival governments and parliaments.
One of the militias, the Fajr Libya coalition of Islamists, controls the capital, Tripoli, and areas in the west of the North African country.
Vallisa was working in the coastal city of Zwara, west of Tripoli, for Italian building group Piacentini Costruzioni when he was kidnapped on July 5th.
Two colleagues taken with him, Bosnian Petar Matic and Emilio Gafuri from Macedonia, were released two days later.
At the time Italian media said the abduction was thought to have been motivated by the possibility of securing a ransom.
"For us it is the end of a nightmare," said Marco Bricconi, the mayor of Cadeo, the freed engineer's home town in northern Italy.
Vallisa's liberation leaves five Italians who are thought held by abductors in various hotspots around the world.
Aid workers Vanessa Marzullo and Greta Ramelli went missing in July in Syria, where Jesuit priest Paolo Dall'Oglio was kidnapped in July 2013.
Engineer Gianluca Salviato was kidnapped in Libya in March and another aid worker, Giovanni Lo Porto, disappeared in the Pakistan-Afghanistan border area in January 2012.