Spain's Parliament passed an austerity budget for 2011 by a razor-thin margin, saving embattled Prime Minister Jose Luis Rodriguez Zapatero his job.
It also gave him a victory in his bid to convince markets that the nation would take control of its finances and avoid a Greek style-bailout.
The lower house of congress passed the budget in a 177-171 vote, approving a spending plan that cuts spending by 8% compared with 2010 and sets funding for government ministries at 2006 levels.
Zapatero got crucial support from smaller regional parties to give him enough votes. He leads a minority government that relies on them to get laws passed, cutting deals in return for the support.
The vote came after ratings agency Moody's warned last week it might downgrade Spanish government debt because of grim prospects for economic growth. Spain is struggling to emerge from nearly two years of recession triggered by a burst real estate bubble. Unemployment stands at nearly 20%, and is much higher for young adults.
On Monday, Moody's Investor Service also announced it might downgrade the debt of Spanish banks, saying their capitalisation, profitability and access to market funding would remain weak because of Spain's sour economy.
Failure to pass a budget would have been unprecedented since Spain returned to democracy in 1975 after the death of dictator Francisco Franco - and probably would have forced Zapatero to call national elections next year. They are currently scheduled for 2012.
Spain is key to the survival of the eurozone because its economy is the bloc's fourth largest, and investors fear a bailout would be too expensive for the zone to handle.
Zapatero insists Spain won't need outside help, and his administration released figures today showing that central government's deficit through the end of November was down 46% from the same period in 2009.
Finance Minister Elena Salgado insisted that Spain would have no financing troubles next year, aiming to quell market fears.