Spain's right stormed to its biggest election win ever, unleashing dancing in the street by voters desperate for an end to soaring unemployment and a eurozone debt storm.
Mariano Rajoy, the bearded 56-year-old leader of the conservative Popular Party, literally jumped for joy as he proclaimed victory.
"Forty-six million Spaniards are going to wage a battle against the crisis," he told a sea of cheering supporters from a balcony outside his party headquarters in Madrid, where cars blared their horns in the streets.
Voters handed the ruling Socialists their biggest defeat in history, chasing them from seven years in office in which an economic boom went bust and the unemployment rate shot to 21.5 per cent.
"The Socialist Party did not have a good result. We clearly lost the elections," the party's candidate for premier, 60-year-old Alfredo Perez Rubalcaba told his party faithful.
Spain's government was the last to fall among the eurozone's so-called periphery nations this year, after Ireland, Portugal, Greece and Italy all succumbed to a collapse of confidence in their sovereign debt.
With more than 97 per cent of the ballots counted, Rajoy's Popular Party had 44.57 per cent of the vote and an absolute majority of 186 seats in the 350-member Congress of Deputies.
The win gives Rajoy a free hand to ram through severe austerity measures in the eurozone's fourth biggest economy.
The Socialists won 28.67 per cent of the vote, giving them 110 seats, the partial count showed.
"Spain needed a change. We have had eight years of a failed government," said 16-year-old high school student Jorge Alises who carried a Partido Popular flag as well as a red and yellow Spanish one.
"I have a lot of faith in Rajoy's team. They are very focused on Spain's main problem, which is the economy."
Though considered uncharismatic, Rajoy won support from voters lured by his promise to fix the economy and create jobs, even if it means more austerity.
He has vowed to make cuts "everywhere", except for pensions, so as to meet Spain's target of cutting the public deficit to 4.4 per cent of gross domestic product in 2012 from 9.3 per cent last year.
"This will be a strong change for the whole of Spain," said one celebrating Popular Party supporter, Alicia Borderia, 46, who is unemployed.
"He will take measures to get us out of the crisis and unite us."
Analysts say Rajoy, who will be sworn in from December 20, must quickly impose reforms to reassure world markets.
Spain's risk premium - the extra interest rate investors demand to buy Spanish compared with safe-haven German debt - shot to a euro-era high of more than 500 basis points in the days ahead of the vote.
Prime Minister Jose Luis Rodriguez Zapatero's government was blamed for reacting too late to the 2008 property market implosion, which combined with a global financial crisis to throw millions out of work.
As his government battled to cut back spending and avoid a disastrous loss of confidence by the debt markets, it cut public sector wages by an average 5.0 per cent, froze pensions and raised the retirement age from 65 to 67.
Zapatero called the election four months early to give a new government the chance to confront the crisis. After two terms in office, he decided not to run again.
A nationwide protest movement erupted in May 2011 to vent anger over the high jobless rate and political corruption.
Hundreds of "indignant" protesters rallied in Madrid in the days before the election and analysts say many more may flood the streets next year if the cuts go even deeper.