MADRID (Reuters) - Left-wing parties are close to winning an absolute majority of parliamentary seats in Spain’s general election Sunday, preliminary results showed, likely scuppering Prime Minister Mariano Rajoy’s chances of winning a second term for the People’s Party (PP).

Despite garnering the most votes, the center-right PP had its worst result ever in a general election as Spaniards hurt by a grinding recession and yet to feel an economic recovery turned away from the party in droves.

Anti-austerity Podemos roared into third place, outpacing fellow newcomer Ciudadanos whose market-friendly policies had been seen as a natural fit for a PP coalition.

Podemos’ unexpected surge tipped the balance to the left of the political spectrum with five left-wing parties led by the opposition Socialists and Podemos together garnering 175 seats, just one seat below the 176 needed for a majority.

Such an alliance will however not be easy to agree on as some of these groups differ on economic policy or on the degree of autonomy that Catalonia should enjoy.

“The situation is highly complicated, I don’t see an easy outcome,” said Ignacio Jurado, politics professor at York University.

“The PP will be the first to try and form a coalition but the left-wing bloc has more chances because they add up to more seats,” he also said.

The uncertainty casts a pall over an economic reform program that has helped pull Spain - the fifth-largest economy in the European Union - out of recession and dented a still sky-high unemployment rate.

“This result confirms Spain has entered an era of political fragmentation,” said Teneo Intelligence analyst Antonio Barroso. “The key question is whether there will be a coalition of parties against Rajoy.”

A minority PP government would be technically possible but unlikely due to the strong left-wing vote, as would be a grand coalition between the PP and the Socialists, which both parties vehemently ruled out during campaigning.

At the PP headquarters in central Madrid, a party spokesman said it was clear the party had won the most votes but that the night was not over. A few dozen supporters gathered, waiting for Rajoy’s appearance, some waving red and yellow Spanish flags.

“I don’t understand, it’s very unfair,” said Marta de Alfonso Molero, a 48-year-old chemist who has voted PP all her life, speaking of the poor showing for the party. “They have dragged Spain up these last four years.”

Hundreds of mostly young supporters for Podemos gathered in central Madrid in a party atmosphere, holding purple balloons, the color of the barely two-year-old party.

Slideshow ( 14 images )

“The two-party system is over and we are entering a new era in our country,” said party deputy Inigo Errejon.