Italian PM Silvio Berlusconi has narrowly won a vote of confidence in the lower house of parliament by 314 to 311, prompting street protests.
In Rome, violent clashes have left 50 police officers and at least 40 protesters injured.
The marchers set fire to cars, threw stones and overturned bins in Italy's worst street violence in recent years.
Mr Berlusconi's critics say he is too deeply mired in scandal and corruption allegations to remain in office.
The Italian prime minister, 74, is halfway through a five-year term but his position has been weakened by a series of scandals, largely involving his relationships with women.
He has also lost the support of his closest political ally, Gianfranco Fini, along with dozens of his supporters, depriving him of his automatic majority in the lower house.
Thousands of people gathered in Rome and Italy's other major cities to demand a change in government.
Police fired tear gas on the protesters in Rome and several explosions - thought to be fireworks - were heard. Demonstrators threw eggs, paint and stones at parliament buildings.
Inside, two opposition deputies switched sides for the final vote, giving Mr Berlusconi a narrow victory.
Scuffles broke out in the lower house after opposition MP Katia Polidori voted in favour of Mr Berlusconi, and voting was briefly suspended.
Speaking in parliament, former anti-corruption judge Antonio Di Pietro - who now leads the opposition Italy of Values party - told Mr Berlusconi he was finished.
"Whatever the result of the vote you have bought, one thing is clear. You do not have a political majority that would allow you to govern," he said.
"Whether you like it or not, you have reached the end of the line for your political experience."
Last week, Mr Pietro made a formal complaint alleging that Mr Berlusconi was trying to buy votes. Rome magistrates have now begun an investigation.
There were also protests elsewhere.
In the Sicilian regional capital, Palermo, 500 students occupied the main airport runway.
In Turin in the north, students occupied the railway station, while in Venice they held a demonstration on the famous Rialto Bridge.
The demonstrations follow weeks of bitter protests against the government, which has announced austerity measures, including cuts in education spending.
The BBC's Duncan Kennedy in Rome says although Mr Berlusconi's lobbying has paid off for now, he will still face considerable opposition to his leadership.
Mr Berlusconi has become notorious for his gaffes. At a dinner with his MPs the night before the vote, the newspaper Corriere della Sera quoted him as saying: "I am unable to say 'No', I have never been able to, I've been lucky that no gay person has ever come to proposition me."