Spanish stocks fell on Monday after the general elections held over the weekend failed to produce a clear winner, with investors punishing banks and energy companies in particular.

Spain faced a political deadlock on Monday after right-wing parties failed to win a decisive victory and no clear winner emerged in Sunday's national elections, leaving small regional Basque and Catalan parties as key players in forming a government.

Madrid's IBEX 35 index was down 1.8% in early trading and 0.75% at 1110 GMT. It underperformed the STOXX 600 index, which was unchanged.

The center-right Popular Party (PP) and the far-right Vox obtained 169 seats in the Congress of Deputies, while the governing Socialists (PSOE) and the left-wing Sumar obtained 153, far short of the 176 seats needed for a majority.

"The generalized falls are due to the fact that the market expects either a weak government or an early election," said Natalia Aguirre, head of analysis at Renta 4.

"Now a period of uncertainty is opening up, which is the worst possible scenario for the markets."

This outcome could ultimately lead to the extension of an extraordinary tax on the financial and energy sector beyond the current two-year period. The leader of the PP, Alberto Núñez Feijóo, had pledged to modify the taxes if he came to power.

Shares of major banks Santander, Sabadell and Caixabank were down between 1.4% and 2.6%. The Stoxx 600 index of banks was down 0.4%.

Goldman Sachs said Monday that the election result may also be a temporary setback for Spanish energy companies, as the market had recently turned more positive on Endesa and Iberdrola due to "a possible change of government and the prospect of less regulatory intervention."

Endesa was down 3.5%, while Iberdrola fell 0.4%.

Fiona Cincotta, strategist at City Index, said, "I don't think it's necessarily part of a darker outlook for Spain in the long term, but I just think at the moment, we're seeing uncertainty and markets hate uncertainty."

Political consultancy Eurasia Group said this uncertainty could last for months, just as it did in 2019, when two consecutive elections were held before a government could be formed.

"For now, a repeat election seems the most likely way out of the impasse (a 40% probability); if so, they will most likely be held in the fourth quarter of this year," said Eurasia Group's senior analyst for Europe, Federico Santi.

The risk premium on Spanish government bond yields compared to benchmark German 10-year bonds widened slightly to around 106 basis points.

The Spanish economy has held up relatively well, but is slowing after the post-pandemic rebound. The government forecasts 2.1% growth for 2023, down from 5.5% last year.

A slowdown means Spain's high debt of more than 100% of GDP and deficit of 4.8% of GDP are in the crosshairs, and protracted talks to form a government could slow fiscal reforms and worsen its finances.

Giles Gale, head of European rates strategy at NatWest Markets, says the election has been only slightly negative for Spanish government debt compared to its German counterparts.

"There are plenty of reasons for resilience," he said. "The strong fundamental story remains in place: positive debt dynamics, economic momentum and financial resilience, strong financing progress and rising domestic demand for debt."

(Additional reporting by Stefano Rebaudo and Danilo Masoni in Milan and Harry Robertson in London; edited in Spanish by Javi West Larrañaga, José Muñoz and Benjamín Mejías Valencia)