Spanish Prime Minister Pedro Sánchez resigned as leader of the Socialist Party on Monday, a day after conservatives and the far right won enough seats to form a new government, ending his eight-year rule.

Sánchez announced the decision after meeting fellow party leaders on Monday morning at the Socialist headquarters on Calle Ferraz in Madrid, stepping down as secretary-general of the Spanish Socialist Workers' Party (PSOE) and renouncing his seat in parliament in a short televised address.

"Yesterday, unfortunately, the parties of the left weren't able to win a majority, while another coalition was. That can't be ignored," Sánchez said. "I'm doing this out of coherence, out of responsibility to the country, and of course to my organisation."

On Sunday, Spain's conservative People's Party, led by Alberto Núñez Feijóo, won 132 seats, while the far-right Vox party secured 52. Together they took 184 of the 350 seats in the lower house of Parliament, comfortably above the 176 required to form a government. Sánchez's Socialists finished with 116 seats and 28.87 percent of the vote, down from 121 seats and 31.68 percent in 2023. Sánchez called Feijóo before 11 p.m. on Sunday to concede defeat.

"Today, I am taking the first step so that this great party, this century-old party that has survived dictatorships, exile and defeats far harsher than this one, can rise to its feet once again, as it always has, and embark on a new beginning," Sánchez said. "I believe we're leaving a better Spain than the one we found in 2018."

Sánchez, who has governed Spain since 2018 and was known for his progressive policies, including championing women's rights and green energy, will remain acting prime minister with restricted powers until Parliament convenes next month to replace him. Feijóo is expected to begin coalition talks with Vox to form the new government.

A caretaker committee will run the Socialist Party until after the regional and municipal elections in May, when the party will hold a special congress with a primary to choose a new secretary-general. Sánchez is also giving up his role as president of the Socialist International, effectively withdrawing from front-line political life after eight years in office.