Spain's center-right People's Party (PP) won the country's general election Sunday, while the far-right Vox party surged into second place, delivering a decisive rejection of the governing Socialists and setting up a government that will depend on the nationalist right.

The result ends more than five years of rule under Prime Minister Pedro Sánchez's Socialist-led coalition, which governed alongside the hard-left Sumar alliance. PP leader Alberto Núñez Feijóo now faces the task of assembling a majority in Spain's 350-seat Congress of Deputies, where the combined PP and Vox bloc is expected to fall short of the 176 seats needed to govern outright, according to projections reported by Spanish media.

That arithmetic leaves Feijóo dependent on Vox, the party led by Santiago Abascal, whose strong showing marks the first time a far-right force has reached such prominence in Spain since the country returned to democracy after Francisco Franco's death in 1975.

"With a great victory comes a great responsibility," Feijóo told supporters gathered outside PP headquarters in Madrid. "We are going to try to govern for everyone, for all Spaniards, no matter who they voted for."

Abascal, addressing his own supporters, was more blunt: "Mission complete!" he declared, framing the night as the end of the Sánchez era.

The election was called after the Socialists suffered heavy losses in May's regional and municipal elections, a result Sánchez described at the time as a message that his government had to respond to. Turnout ran high, with long lines reported at polling stations in Madrid and Barcelona as voters weighed inflation, housing costs and the economy.

Sánchez's campaign had warned that a PP-Vox government would roll back abortion rights, LGBTQ protections and regional autonomy, while Feijóo pitched himself as a moderate manager who would lower taxes and restore economic stability. Vox campaigned on tighter immigration controls, scrapping laws on gender-based violence and recentralizing power from Spain's regional governments.

The outcome puts Spain alongside a growing list of European Union members where nationalist parties have entered government or gained decisive influence, including Italy, Hungary, Poland and Sweden. Spain currently holds the rotating presidency of the EU Council, a role it took up on July 1 and will hold through the end of the year.

Forming a government will require weeks of negotiations. If no bloc can command a majority, Spain faces the prospect of a repeat election, as it did after the inconclusive votes of 2015 and 2019.