Italian Prime Minister Silvio Berlusconi has scraped through a crucial confidence vote in the lower house by 314 votes to 311.
He had earlier won a Senate vote by a comfortable majority.
The result reinforced Mr Berlusconi's reputation as one of the great survivors of Italian politics but left him badly weakened, without the numbers in parliament to ensure stability at a time of economic challenges.
Vote counting after an acrimonious debate was briefly interrupted by a scuffle between deputies from rival camps.
Pier Luigi Bersani, head of the opposition Democratic Party, said Berlusconi's survival was a Pyrrhic victory.
'You, prime minister are no longer in a position to govern,' he told parliament.
Riot police blocked off the centre of Rome after the vote and clashed with protestors who threw firecrackers and paint bombs at the Senate and oranges at the economy ministry.
After a year overshadowed by corruption and sex scandals and an acrimonious split with former ally Gianfranco Fini that cost him a secure parliamentary majority, the result offered at least a temporary lifeline to the 74-year-old premier.
Mr Berlusconi has repeatedly defied sceptics, shrugging off a string of gaffes and scandals to win three elections and transform Italy's political landscape since gaining power for the first time in 1994, but he has polarised Italians.
Thousands of students, workers and other government opponents staged other protests around the country this afternoon.
More than 90 people were injured as police clashed with the protestors.
Had Silvio Berlusconi lost in the lower house following a clear win in the Senate earlier, he would have had to resign, potentially opening the way to early elections more than two years before they are due in 2013.
The result was secured after a fevered campaign of back room deals, in which opposition accusations of vote-buying and corruption have been answered by fierce denials and counter-accusations of treachery.
Today's votes were being closely watched by financial markets on high alert over the eurozone debt crisis, and a prolonged period of uncertainty or a divisive election campaign could turn the spotlight on Italy's strained public finances.
Italy has one of the heaviest public debt burdens in the world, at almost 120% of gross domestic product.
However, it has largely escaped the eurozone debt storm, thanks to tight control of spending and a conservative banking system that avoided excess during the market boom.