MADRID — After nearly a year without a government, Spain broke its deadlock Tuesday with a parliamentary vote that narrowly approved a left-wing coalition led by current caretaker Prime Minister Pedro Sánchez.

The vote allows for Sánchez’s Socialists, the country’s traditional left-wing party, to form a government with their erstwhile antagonist, far-left Unidas Podemos. It also vaults the left fully back into power in Spain at a time when mainstream parties elsewhere in Europe have struggled to combat populism or overcome disenchantment with the political status quo.

But while the parliamentary vote restores a measure of clarity in a country that has become emblematic of fragmented, multiparty politics, the new government will be fragile. It will control a minority of seats in parliament and depend on support from a constellation of smaller parties while dealing with the country’s most significant crisis in decades, Catalonia’s battle for independence.

“A country without a government is a country without the tools to face the future,” Sánchez said Tuesday, making a final case to parliament to gain its backing.

Tuesday’s debate offered a vivid picture of the bargaining that brought the government about. The left’s path to power hinged on a Catalan separatist party that had pledged, crucially, to abstain in Tuesday’s vote. Right-leaning politicians castigated Sánchez for his outreach to those separatists, accusing him of abandoning the country’s interests in a bid for power. When separatist Catalan politician Montserrat Bassa took her turn to speak, she said that she “couldn’t care less” about the central government in Madrid, but that her party would help Sánchez nonetheless.

Sánchez, as part of his pre-vote negotiations, has pledged to reopen talks with the Catalans while saying that “Spain is not going to fracture.”

The new government’s first order of business will be to pass a general budget for Spain, which has been on hold for nearly two years. Negotiations over that budget last year caused a previous Sánchez government to collapse after he failed to get backing for his plan.

Sánchez had been unable to win support in an earlier proceeding Sunday, which required an outright majority in the 350-seat parliament. But the bar lowered for Tuesday’s vote, which required only that the “yes” votes outnumber the “no” votes — meaning abstentions could help launch a minority government into power. With 18 lawmakers abstaining, 167 voted in favor of the government and 165 voted against. Some of the politicians who backed the deal mentioned that the only alternative would be going back to the polls for Spain’s fifth election in just over four years.

That period of instability has come as upstart parties have tried to break up the nation’s long-standing two-party system. While the traditional Socialists and right-center Popular Party have lost ground, none of the upstarts have managed to fully sweep in, leading to a diluted landscape where elections produce either weak governments or no government at all.

An April 2019 election produced no government; the Socialists won the most votes, but then squabbled with Podemos about joining hands. Instead, Spain went back to the polls. In a November vote, the Socialists again won the most seats — but fewer than before, and Podemos fared worse, as well. The formal Sánchez and the ponytailed Podemos leader, Pablo Iglesias, quickly drew up a deal, chastened by their previous failure and hoping to avoid yet another election. Analysts say the parties were also moving to stave off far-right Vox, which has emerged as Spain’s fastest-growing party.

Vox has grown largely by presenting itself as the firmest defender of the country’s unity amid the Catalan crisis. The majority of Spaniards are opposed to Catalan independence, and in Catalonia attitudes are divided. Several recent flash points have re-inflamed the crisis, particularly the Supreme Court sentencing last October of nine Catalan leaders on sedition charges.

The abstention pledge from the Catalan separatist ERC party figures to force the restart of negotiations with Sánchez that had broken down while he was caretaker. But the Socialists have emphasized that they are not interested in greenlighting an official referendum on independence.

Though some pro-independence Catalans might view the ERC as traitors for dealing with the government, ERC is trying to position itself as a party moving ahead with negotiations after other efforts to spark independence have failed and drawn fierce pushback from Madrid.

“It’s clear that the unilateral route toward independence failed,” said Carlos Barrera, a politics professor at the University of Navarra. “So they are now looking to go toward the negotiated route and see how much they can get from a weak government. ERC is now personifying that route with this gamble. If the negotiation fails, at least ERC can say they tried. And if it succeeds, they can claim victory.”