“The Socialist Party won, and we are now going to build the Spain we want,” Sánchez said at a victory rally after the votes were tallied. The win was seen as a strong endorsement of Sánchez’s unapologetic left-wing policies, which have included a pension overhaul and raising the minimum wage by 22 percent in 2019.

AD

“This demonstrates the support the whole country has done in defense of democracy,” he said. “It doesn’t want to go back. It wants a country that advances.”

AD

The Socialist party will, in theory, be able to form a governing coalition with the far-left, anti-austerity Podemos faction, and it will probably gather the necessary 176 seats by joining forces with a number of Basque regional parties.

Podemos signaled its willingness to work with Sánchez, a social democrat, however reluctantly.

“It’s not the result we wanted, but it’s enough to achieve our objectives,” Podemos leader Pablo Iglesias said.

Sunday’s election was triggered by Sánchez’s earlier failure to pass a 2019 budget. But deeper challenges overshadowed the contest: A general frustration with the status quo that echoes public discontent elsewhere in Western Europe, and widespread anger over the Catalan independence crisis, which critics said the left-wing government had failed to handle adequately.

AD

AD

Catalonia has long been a political liability for Spanish governments, and Sánchez’s was no exception.

In October 2017, Catalan leaders staged an illegal referendum on independence in open defiance of the constitution. Now, 12 Catalan leaders are standing trial in Madrid on charges of rebellion, sedition and the misuse of public funds, but Sánchez’s minority Socialist government was able to assume power only after aligning with Catalan separatist factions.

His critics on the right accused Sánchez of being too soft on Catalan, and tens of thousands of right-wing protesters took to the streets in Madrid this year to demand a snap election.

The choices on Sunday’s ballot were a testament to right-wing frustrations with the Socialist administration. Voters chose among five parties, including Vox, a far-right faction founded on anti-immigrant, anti-feminist and anti-Catalan sentiment. Those parties fared worse than expected Sunday, and Sánchez is no longer beholden to Catalan separatists.

AD

AD

Sánchez came to power as a result of a no-confidence vote against the previous, center-right government. But Sunday’s results were strong evidence that he now has a considerable mandate.

Vox won 24 seats to become the first far-right party to enter the Spanish parliament since the country’s transition to democracy in the late 1970s. But it had been expected to win nearly twice that many seats.

As has been the case elsewhere in Europe, the emergence of a right-wing fringe faction has pulled Spain’s traditional mainstream center-right parties farther to the right.

Santiago Abascal, the leader of Vox, taunted the ordinarily ­center-right Popular Party as the “cowardly little right.” Popular Party leader Pablo Casado seemed determined to prove Abascal wrong with an anti-Catalan, anti-immigrant hard-line that none of his predecessors pursued.

AD

AD

No party performed as poorly Sunday as the Popular Party, which won 66 seats — a major defeat for a venerable institution that has governed Spain on and off since the transition.

“The fragmentation of the ­center-right makes it difficult to win,” Casado said after the results came in.

If some of his party’s support was siphoned away by Vox, more was probably taken by Ciudadanos, a nominally centrist party that typically supports legislative reform but has cast its decisive support to the right on the Catalan question. The party’s Catalan origins give its staunch opposition to regional independence legitimacy with voters who favor Spanish unity.

AD

Ciudadanos won 57 seats in the election.

Although the Catalan question was a major component of the discussion in the lead-up to the vote, it was not the issue every voter had in mind.

AD

Maria Isabel Gómez cast her ballot outside Madrid on Sunday for the Socialist party.

“This election is about the country’s ability to continue advancing, particularly in social reform, education, health care and personal liberties,” she said. “Vox doesn’t have a program or ideas. We don’t know what they will really do, but they don’t see democracy the same way we do.”

“Trump is coming,” said her husband, José López, 70, referring to Vox. “They just wrap themselves in the flag and say, ‘We support Spain.’ ”