MADRID (Reuters) - Spain’s ruling Socialists were considering possible partners for a new government for the politically polarized country on Monday after they won a national election but failed to secure a majority.

Prime Minister Pedro Sanchez faces a choice between a complex alliance with fellow leftists Podemos or joining forces across the political divide with the center-right Ciudadanos.

The Socialists won 123 seats in Sunday’s election, up from 84 in the outgoing parliament as they saw off the challenge from the right, which was splintered by the rise of the far-right Vox.

With nearly all the votes counted, the Socialists together with the far-left Podemos were 11 seats short of a majority in the 350-seat parliament.

That could mean Sanchez having to rely on pro-independence Catalan parties or Basque nationalists to govern.

“A Socialist-led government with support from Podemos seems the most likely outcome,” rating agency DBRS said in a report.

“This political combination needs the parliamentary support from smaller parties.”

Podemos leader Pablo Iglesais said on Sunday his party would happily enter a coalition with the Socialists, but Sanchez has yet to comment.

Another possibility that Sanchez has not ruled out is an alliance with Ciudadanos. The two parties would have enough seats to govern without other partners - an alliance favored by many in the business and financial world.

However, a Socialist-Ciudadanos deal appeared unlikely on Monday.

Ciudadanos leader Albert Rivera told supporters on Sunday night his party would lead the parliamentary opposition to Sanchez.

Ines Arrimadas, head of Ciudadanos in Catalonia, added on Monday: “Everyone who voted for Ciudadanos did so knowing that we would not ally with Sanchez.”

Slideshow ( 4 images )

POLITICAL MINEFIELD

Either way, negotiations on forming a government could take weeks or even months.

Under Spanish electoral law, a new government requires an absolute majority in parliament to take office in a first round of voting.

To do that in combination with Podemos, the Socialists would require the support of at least one lawmaker from the Catalan separatist camp.

Slideshow ( 4 images )

The region’s independence drive was the most divisive issue in an election dominated by a sometimes fraught debate over national identity. In cutting a deal with the separatists, Sanchez risks stepping into a political minefield.

In any second round of voting, Sanchez would need only a simple majority to get his government voted in, which the Socialists and Podemos could do with backing of all regional parties except the Catalans, plus one abstention.

The picture could still change when the election count is finalised in coming weeks.

Still, the left clearly won Spain’s third national election in four years as the mainstream conservative Popular Party (PP) lost votes to Vox, which benefited from anti-immigration sentiment and concerns over Catalan separatism.

Vox became the first far-right party in Spain to have a major representation in parliament since the death of dictator Francisco Franco in 1975.

The PP had its worst election since the early 1980s, winning just 66 seats - less that half of its total in the outgoing parliament.

The PP, together with Ciudadanos and Vox combined only won 147 seats.

Sanchez called the election after failing to win support in parliament early this year for his 2019 budget.

Ciudadanos got 57 seats on Sunday, Podemos 42 and Vox 24.

Spanish stocks lagged broader European markets early on Monday