Spain's third parliamentary election in less than four years did little to dispel uncertainty over the political future of the eurozone's fourth largest economy.

The center-left Socialist party won re-election in Sunday's ballot, collecting nearly 29 percent of votes, and will try to form a government. It would be one of only a handful of socialist governments in the European Union.

But with only 123 seats in the 350-seat Congress of Deputies, Spain's parliament, it needs to negotiate the support of smaller rival parties to pass legislation.

"Forming a government will be far from straightforward," Antonio Barroso, an analyst with the London-based Teneo Intelligence consultancy firm, said in a commentary Monday.

Even an alliance with the far-left, anti-austerity party United We Can wouldn't give the Socialists the key number of 176 seats.

That means incumbent prime minister, Pedro Sánchez, will need to barter with smaller parties to enact his administration's ambitions and stay in power for the four-year mandate.

Pedro Sanchez addresses supporters in Madrid on Sunday. Pablo Blazquez Dominguez / Getty Images

Spain's political landscape has fragmented in recent years, after decades in which the Socialist party and the conservative Popular Party took turns in power.

Forging cross-party alliances has proved difficult for political negotiators and has unsettled Spanish governments. In 2015, a splintered parliamentary outcome from a general election led to inconclusive negotiations and a repeat election the following year.

"The country has endured an excessive amount of instability," La Vanguardia newspaper said in an editorial Monday. "That is never good. And it's even worse when the European Union has the same problem, due to Brexit and the rise of populism."

The Socialist party, which came to power last June in a minority government, increased its number of seats from 84 to 123.

The center-right Citizens party, which has in many aspects been hostile to the Socialists' political agenda, shot from 32 to 57 seats, while the Popular Party lost more than half of its parliamentary representation as it fell to 66 seats.

Adding to the parliamentary makeover, the far-right Vox party claimed 10 percent of the vote and 24 seats. It is the first time since the 1980s that a far-right party will sit in the national parliament.

Vox party leader Santiago Abascal delivers a speech on Sunday. Oscar del Pozo / AFP - Getty Images

In all, five parties got more than 20 seats.

Another unpredictable path that Sánchez could consider is to seek the support of secessionists in Catalonia.

The unflagging demands of separatists for that wealthy region's independence brought in 2017 Spain's worst constitutional crisis in decades, and the price of their support may be too high for Sánchez.

Amid all the party-political considerations, the new government faces the daunting task of cutting chronic unemployment and keeping the public pension system from collapse. The Spanish jobless rate in February was almost 14 percent — compared with an average of just under 8 percent for eurozone countries.

No immediate progress on forming a government is likely. Spain is due to elect regional and local governments, as well as its European Parliament deputies, in four weeks' time in what will be another test of political strength.