Italian Prime Minister Romano Prodi's government has won a vote in the Senate to keep Italy's troops in Afghanistan.
Romano Prodi has had to rely on support from the opposition
The vote gives final approval to a measure that provides funding for all Italian missions abroad.
The government saw off a rebellion from some left-wing members of the ruling coalition, to repeat the victory it had already achieved in the lower house.
Commentators had said that a defeat in the vote could have led to the collapse of Mr Prodi's fragile government.
In the event it was carried by 180 votes to two, with 132 abstentions, which in the Senate count as "No" votes.
The parties on the far left of Mr Prodi's alliance want the 1,800 Italian troops currently deployed in Afghanistan to come home.
In previous votes on Afghanistan, he has been propped up by the centre-right opposition led by Silvio Berlusconi, which supports the deployment.
But Mr Berlusconi has become more critical - notably of the way in which the government negotiated the release of an Italian journalist kidnapped in Afghanistan by the Taleban, a deal which saw five Taleban prisoners freed in exchange.
Italian troops will remain in Afghanistan for some time yet
Come the vote, the opposition split, with senators from Mr Berlusconi's party abstaining, but most of the Christian Democrat Party backing the government.
Italian President Giorgio Napolitano had issued an eleventh hour plea to all sides to reach agreement on an issue affecting national troops abroad.
The Italian troops form part of the Nato mission in Kabul and Herat, not the more dangerous south of the country.
Nato can now be reassured that Italy will remain part of the coalition for the time being, says the BBC's Christian Fraser in Rome.
And Mr Prodi lives to fight another day, though his seems to be a government that stumbles from one crisis to another, our correspondent adds.