(Bloomberg) -- Pedro Sánchez’s Socialist party was poised to lose control of several key regions and cities in Spain’s local election on Sunday, complicating the prime minister’s effort to win a new term later this year. 

Alberto Núñez Feijóo’s conservative People’s Party, joined by the far-right Vox, was on track late Sunday to flip control of the Valencia, Aragón, La Rioja and Balearic regions while the PP solidified its control of the Madrid region, according to preliminary results with most areas reporting more than 80% of the votes. Twelve regions were up for grabs in the ballot and more than 8,000 municipalities. 

Historically, the party that comes on top in the local election tends to win the national vote, which will be held in December. Sunday’s result could pave the way for the PP to return to power five years after the Socialists ousted them from government, even though Spain’s economy under Sánchez has performed better than expected. 

“This is a bad result for the Socialists,” Ramón Mateo, director of policy of the BeBartlet consultancy firm in Madrid, said in an interview. “The PP has gained institutional muscle and reinforced its narrative of change.”

The Socialists have been running on Spain’s strong growth this year, which has outperformed most of its euro-area peers. Sánchez pumped billions of euros into the economy in an effort to tame inflation and to shield households and businesses from rising costs.

The Spanish government put in place windfall taxes on energy companies and banks as well as a wealth tax to help offset rising costs. Spain has also received more than 50% of the €69.6 billion ($74.6 billion) in grants allocated to it from the European Union’s pandemic-era recovery fund.

The Bank of Spain said earlier this month that it would likely boost its 2023 outlook for expansion above 2%. The resilient economy led the budget ministry to predict that Spain would be able to cut its deficit to 3% of economic output in 2024, a year ahead of target.

Markets have remained relatively quiet in the weeks ahead of the election with Spain’s 10-year bond yield up about 10 basis points since January to trade at 3.59%. The IBEX-35, which tracks Spain’s most liquid stocks, is up nearly 12% this year.

But Sanchez’s message of a strong economy didn’t deter a positive outcome for the PP. Furthermore, Sanchez’s minority coalition partner, far-left Unidas Podemos, came out battered from the election, losing representatives and preventing the Socialist’s from retaining key strongholds.

“Of course, this is not what we expected,” Socialist spokeswoman Pilar Alegria told reporters late Sunday. “We understand the message and we’ll start to work more intensely right away.”

The biggest factor complicating December’s general election is the fragmentation of the political center, which has made it unlikely that a single party will be able to gain an absolute majority on its own. 

Feijóo will likely have to form an alliance with the anti-migration Vox party to form a government, while Sánchez may have to rely on regional movements and smaller groups on the left such as Unidas Podemos. 

Labor Minister Yolanda Díaz started a new party called Sumar with the intention of bringing all the far-left groups under a single banner that could help Sánchez form a government, even if he loses the general vote. So far Podemos, which has seen its support fall since the last election, has balked at joining this alliance, waiting to see the results of the regional ballot. 

If this coalition were to materialize, it could thrust Díaz into the role of kingmaker for the Socialists. 

Windfall Taxes

Feijóo has promised to be more business-friendly than Sánchez, who has had a contentious relationship with corporate Spain.

The prime minister got in public spats with Banco Santander SA Chairwoman Ana Botin and Iberdrola SA Chairman Ignacio Galán over their stance on Spain’s corporate windfall tax. He also criticized Ferrovial SA Chairman Rafael del Pino over the decision to move the engineering company to the Netherlands.

The Socialist government has also angered large firms by slapping windfall taxes on energy firms and banks, and has raised concerns by announcing plans to create an observatory to monitor corporate profits.

“One of the main results of this election is the sharp decline of the far-left parties, which are currently divided,” BeBartlet’s Mateo said. “That reduces the chances of a repeat of the current government coalition in the upcoming general vote.”

©2023 Bloomberg L.P.