For the leader of Spain's right, Mariano Rajoy, winning Sunday's elections may prove to be the easy part: now he has to win over the markets.
Rajoy will have to show he can trim Spain's bulging budget, and quickly, or risk the same fierce financial pressures that forced governments in Italy and Greece from power.
"After the November 20 elections we will have completed an unwritten, unplanned process of replacing all the governments of Europe's periphery economies: Greece, Ireland, Portugal and Italy, as well as Spain," said a report by Bankinter.
Investors fled those countries the moment they doubted their commitment or ability to cut spending and repay sovereign debt.
In the case of Spain, where the ruling Socialists are blamed for economic stagnation and an unemployment rate of 21.5 percent, the punishment mounted up to the final trading days before the vote.
The debt risk premium -- the extra return investors demand for Spanish 10-year bonds over safe-haven German debt -- shot above 5.0 percentage points Thursday for the first time since the creation of the euro.
The arrival of Rajoy, leader of the conservative Popular Party, may not suffice to calm the storm in Spain, the fourth largest economy in the 17-nation single currency region.
According to an exit poll by public broadcaster RTVE, his party took an absolute majority of between 181 and 185 seats in the 350-member Congress of Deputies, giving him nearly a free hand for reforms.
"The new government will not have the usual 100-day grace period and will have to present measures and goals even before its investiture," Bankinter warned.
But whatever the new government does, the solution may lie beyond Spain's borders with the European Central Bank, Bankinter said in a report.
"In our opinion, no austerity measure in the countries under pressure can dramatically convince the markets unless there is a strong intervention by the ECB," it said.
Rajoy has pleaded for a breathing space to act.
"We hope that this will stop and that they realise that there are elections here and that those who win these elections have the right to a minimum margin, which should be of more than a half hour," he said.
The first challenge is the deficit, which Spain has vowed to cut from 9.3 percent of gross domestic product last year to 6.0 percent in 2011, 4.4 percent in 2012 and 3.0 percent -- the European Union limit -- in 2013.
The Bank of Spain and the European Commission each say those targets cannot be reached without further measures, blaming powerful but spendthrift regional governments.
With an unemployment rate of 21.52 percent, the highest in the industrialised world, labour market reform, which began in 2010, must go deeper, analysts say.
Xavier Vives, professor at the IESE Business School, said Spain must create a single work contract, scrapping its dual system of indefinite and casual contracts.
The third challenge is economic growth, which fell to zero in the third quarter when compared to the previous three months.
Spain's government admitted four days before the vote that the economy would grow only 0.8 percent over the whole of 2011, far short of its official 1.3-percent target.
Recession could return in 2012, according to Goldman Sachs, the French bank Natixis and the French statistics institute INSEE.
Finally, the banking sector, pounded by the 2008 property bubble collapse, has to be put right.
It is weighed down with 176 billion euros ($238 billion) in bad loans and repossessed buildings and land.
The business daily El Economista estimated last week that Spain has private bank and public treasury debt payments due in 2012 of a total 335 billion euros, for which it may need to ask for 100 billion euros.
According to the paper, Rajoy has already spoken to German Chancellor Angela Merkel about the conditions for possible European financial assistance to Spain.
"One of the first decisions the new government might be forced to make is negotiating with the IMF and/or the EFSF (European Financial Stability Facility) a precautionary credit line," said Unicredit analyst Jose Abad.
If the aid does come in at 100 billion euros, "that would be a real rescue," said IG Markets analyst Daniel Pingarron, who said he expected Spain to seek temporary lines of credit on a much smaller scale.