Spanish Prime Minister Mariano Rajoy sent his Portuguese counterpart congratulations on a recent election victory but if Rajoy snares the same kind of win in his own country's election in December, he'll have little to celebrate.

Portugal's center-right coalition government for the past four years got the most votes in a general election this month as it rode the start of an economic recovery. It collected 38.5 percent despite enacting austerity policies in the debt-heavy country that needed a 78 billion-euro ($89 billion) bailout in 2011.

But the government lost its outright majority in Parliament. That means left-of-center lawmakers can block its planned economic reforms and debt-reduction measures that analysts say are vital.

Adding further tensions and drama is the horse-trading of Portugal's defeated center-left Socialist Party, which captured 32.4 percent. There is a growing possibility of it aligning with the smaller, anti-austerity Left Bloc and the anti-euro currency Communist Party — both of which campaigned for Portugal to leave NATO — to set up a controversial majority government.

With election victories like that, who needs a defeat?

The trouble for ruling camps both in Portugal and Spain is that the wounds of austerity are still raw in Iberia.

The financial crunch brought acute difficulties for families in Portugal, Western Europe's poorest country, where the average monthly pay after taxes last year was just 813 euros ($925). Over the past four years, more than 100,000 people a year have left to find work. In Spain, protesters trying to shut down Parliament fought battles against police on streets littered with rocks and thick with tear gas. Their anger has translated into support for radical political alternatives.

Europe's recent financial crisis and public outrage at austerity policies have reshaped the continent's political map. The next candidate for a possible political shake-up is Spain, where corruption scandals have deepened disaffection with the political elite despite an improving economy.

While Portugal represents less than 2 percent of the eurozone's GDP, Spain is the 19-nation bloc's fourth-largest economy and political upheaval there could trigger a period of renewed economic uncertainty for the continent.

The contest between Spain's two traditional mainstream parties and two brash newcomers on Dec. 20 is expected to deny any single party an outright parliamentary majority, like in Portugal.

"For sure you are going to have four political forces, fragmentation, and it's going to make governance (in Spain) more difficult," says Antonio Barroso, an analyst with the Teneo Intelligence political risk consulting group.

Making matters more complicated, Spain has never had a coalition government.

Rajoy's conservative Popular Party, currently with an outright parliamentary majority, and the leading opposition Socialist party are neck-and-neck in the election race, an opinion poll last weekend in the leading El Pais newspaper indicated, with over 23 percent of the vote each. But right on their heels with 21.5 percent was Ciudadanos (Citizens), ahead of Podemos (We Can) on 14.1 percent.

"We're going to go from a very stable arrangement that allowed for pretty significant progress on structural reforms, and a quite impressive degree of fiscal adjustment, to a much more unstable arrangement that's going to make it a lot more difficult to pass legislation and get anything done," said Federico Santi of Eurasia Group. "There are a lot of variables at play. It's not just the four parties, it's any combination of the four parties."

The El Pais survey, conducted by the Metroscopia polling firm, was based on telephone interviews with 1,200 people between Oct. 7 and 8. It had a margin of error of 2.9 percent.

The government expects the economy to grow 3.3 percent this year but Spain still has a 22.4 percent unemployment rate, the second highest in the European Union after Greece. Austerity policies have included slashing public services, while corruption scandals have engulfed Popular Party officials, including former International Monetary Fund chief Rodrigo Rato.

The Socialist Party, too, is tainted by corruption because of two former party chairmen's alleged roles in siphoning money from public funds earmarked for employment and ailing companies.

That has helped Ciudadanos capture Spain's political center, bleeding support from both main parties. The far-left Podemos is hurting the Socialists, although support for the near two-year-old party has ebbed since January.

Pro-business Ciudadanos wants to maintain the country's social welfare system while cutting taxes and red tape and investing in research and development. It also proposes incentives to lure back well-educated Spaniards who left the country during the nation's 2008-2013 downturn.

Podemos casts itself in the renegade mold of Greece's ruling Syriza party, though it has recently toned down its radicalism.

Markets are unlikely to panic at the election result, analysts say, because the Spanish economy is in good health — for now.

"But if the tailwinds become headwinds, that is when political stability will start to matter for markets," said Teneo's Barroso.