Spanish Prime Minister Pedro Sanchez delivers a speech at the PSOE headquarters in Madrid, Spain, Monday.   (Xinhua-Yonhap)
Spanish Prime Minister Pedro Sanchez delivers a speech at the PSOE headquarters in Madrid, Spain, Monday. (Xinhua-Yonhap)

MADRID (AP) -- Conservative and far-right parties defeated Spain's longtime Prime Minister Pedro Sanchez in Sunday's election, with results reflecting wider European demands for tighter immigration restrictions.

With virtually all votes counted after near-record turnout, the conservative Popular Party (PP) and the far-right Vox party secured a combined total well above the 176 seats needed to form a government.

The victory for Spain's right-wing parties marks the end of a nearly decade-long era in which Spain championed progressive causes under Sanchez, including women's rights, green energy, criticism of Israel's treatment of Palestinians and a pro-immigration stance while much of Europe tightened its borders.

PP leader Alberto Nunez Feijoo will become Spain's next prime minister if the PP and Vox agree, as widely expected, to form a coalition when the new parliament meets next month to vote a new government into power.

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

Feijoo thanked his prospective coalition partner, Vox leader Santiago Abascal.

"I want to thank in a very special manner the candidate who saw the biggest rise in the number of seats, Santiago Abascal," Feijoo said.

The PP will return to power for the first time since 2018. Junior partner Vox would make the incoming administration the first to include a far-right nationalist party since dictator Francisco Franco's death in 1975.

"Mission complete!" Abascal shouted to supporters, who hurled insults at Sanchez. "We have kicked them all out!"

Sanchez conceded defeat in a short speech to party members.

"Today is a sad day for our country," Sanchez said. "We haven't achieved our goal of being able to keep together a progressive government."

He will remain in charge of the interim government until the incoming administration takes office.

US President Donald Trump welcomed Sanchez's defeat Sunday, calling it "great news" that the Spanish leader was on track to be unseated.

"That's a good thing," Trump told reporters in Washington. "He did a terrible job. He deserves to lose."

Sanchez has been one of Trump's most outspoken critics in Europe, and the two have frequently clashed over issues including the Iran war, Venezuela and NATO spending.

"This result signifies a strengthening of the axis between the traditional right and the far right on a European scale -- most notably within European institutions," said Steven Forti, a political science professor at the Autonomous University of Barcelona.

The result is also being closely watched across Europe ahead of an election-packed 2027, when voters will head to the polls in France, Italy, Greece and Poland. In France, the far-right National Rally is seeking power, while in Italy, Premier Giorgia Meloni's right-wing coalition is expected to seek another term.

Late Sunday, Meloni congratulated the PP and Vox on their victory, writing on X that she looked forward to working with them "for the benefit of our nations."

The election was seen as a referendum on Sanchez, a politician known for political comebacks, particularly after defying polling predictions in 2023.

The Socialist leader has governed Spain for eight years through numerous crises but also a period of economic growth that, for many voters, has been overshadowed by cost-of-living concerns.

Sanchez called an early election in October, hoping to capitalize on widespread protests over soaring housing and rental costs following the dramatic eviction of an 87-year-old woman from her apartment in Madrid.

The strategy failed.

The PP and Vox benefited from a surge in voter participation, with turnout reaching 79.52%, nearly matching the modern election record of 79.97% set in 1982.

Oriol Bartomeus, a political science professor at the Autonomous University of Barcelona, said the PP and Vox benefited from mobilizing people who had not voted in previous elections.

"There was a brutal jump in participation, but in the pre-election polls you could see that among the people who didn't turn out in 2023 but were going to vote, the PP beat the Socialists 3-to-1," Bartomeus said. "And the far right had an incredible capacity to get people to vote who had not voted in a long time."

With 99.8% of votes counted, the PP won the most seats, securing 132. Vox made the biggest gains, rising from 33 seats three years ago to 52, strengthening its position as the third-largest party in parliament.

"I think this makes a lot of people hopeful again for the future of Spain," said Rafa Castilla, 18, who celebrated at PP headquarters.

"This was necessary for us to have an absolute majority. I think the PP is going to govern for the majority but Vox can do a good job providing it with new ideas."

The Socialists won 116 seats, but Sanchez's chances of maintaining a coalition government collapsed with the decline of his former junior coalition partner.

Feijoo promised voters greater stability and better governance, frequently pointing to crises under Sanchez and corruption cases involving the Socialist Party.

Feijoo criticized Sanchez over two fatal train crashes this year on Spain's high-speed rail network, a nationwide blackout in April 2025 and a border crisis in Spain's North African exclave of Ceuta.

Spain has welcomed millions of immigrants, mainly from Latin America but also from Africa and elsewhere in Europe. One in five residents was born outside Spain, according to census data. Earlier this year, the Spanish government legalized the status of nearly 1.2 million immigrants living in the country without authorization.

Feijoo and Abascal portrayed Sanchez's immigration-friendly policies as harmful to ordinary Spaniards, citing insufficient housing and strained public services. Both condemned the migrant legalization measure.

Vox campaigned heavily on pledges to expel migrants in the style of Trump and give Spanish citizens priority over foreigners for welfare benefits. The PP adopted some of Vox's anti-immigration rhetoric, referring to the tens of thousands of people, mostly Moroccans, who crossed into Ceuta in July as "invaders."

Sanchez, a Madrid native and former economics professor, became a hero to the global left for his government's opposition to the Israel-Hamas war in Gaza. He criticized the US and Israel over the Iran war and was among the first major Western European leaders to formally recognize Palestinian statehood.

Feijoo, by contrast, is a lifelong civil servant-turned-politician from rural northwestern Galicia who does not speak English and presents himself as a sensible, moderate and effective administrator.

He is expected to mend relations with the US and Israel.

Israeli Foreign Minister Gideon Saar congratulated Feijoo and Abascal on their victory, writing Sunday night on X: "I believe that we can now work together to restore Israel-Spain relations."