Official results on Tuesday showed that the Olive Tree coalition led by Romano Prodi took 49.8% of the vote in the lower house of parliament, compared with 49.7% for Berlusconi, the encumbent prime minister.
Prodi also looked set for a victory in the Senate by one or two seats thanks to overseas voters, whose votes were still being counted.
The upper house, the Senate, and the lower Chamber of Deputies have equal powers, and any coalition would have to control both in order to form a government.
However such a narrow margin has been contested by the right and were he to form a split government Prodi would have great difficulty in introducing reforms.
Predictions on the result
fluctuated all night
Speaking to supporters, gathered in a Rome Square on Tuesday, Prodi said: "We have won, and now we have to start working to implement our programme and unify the country."
However many analaysts predict the result will see a return to a revolving door political culture that has seen Italy ruled by 61 governments in as many years.
Il Riformista newspaper declared "Italy is split" after the tighest electoral contest in modern Italian history.
The outgoing administration, headed by Berlusconi for the past five years, is the longest serving Italian government in post-war history.
Pietro Bianchi, a banker from Milan, told Reuters: "Both sides were at a pretty low standard... I think we'll have a government that lasts six months and then parliament will fall apart and we will have to vote again."
"We have won, and now we have to start working to implement our programme and unify the country"
The tight, fluctuating contest has revealed divisions in Italy over major issues.
Italians were mainly preoccupied by economic worries. Berlusconi promised to abolish a homeowner's property tax.
Prodi said he would revive an inheritance tax abolished by Berlusconi, but only for the richest. He also promised to cut payroll taxes to try to spur hiring.
Voter turnout was in the two-day vote about 84%, the interior ministry said.