Spain’s Socialists have signed an agreement to form a governing coalition with the leftist Podemos party, in the hope of ending the country’s six-month political stalemate.

The acting prime minister, Pedro Sánchez, reached the preliminary deal with Podemos leader Pablo Iglesias just two days after Sunday’s general election. Mr Sánchez’s Socialists won the ballot but fell well short of a majority.

“Our country urgently needs a new government up and running as soon as possible,” Mr Sánchez said. “And this new government will be overwhelmingly left-leaning.”

Sunday’s election was held because an April vote had been inconclusive, leading to drawn-out negotiations between the Socialists and Podemos. With the Socialists preferring a confidence-and-supply deal rather than a formal coalition, those talks had descended into a public spat, with each side blaming the other for their failure to reach an agreement. Mr Sánchez even announced his refusal to allow Mr Iglesias to be a minister in his government, citing their political differences.

However, the two parties have swiftly reached an accord this time, mindful that voters’ patience is wearing thin. Although some reports said that Mr Iglesias would take up a senior ministerial role under the deal, the two sides have delayed details of which ministries Podemos would oversee until the new government is formed.

[Guy Hedgecoe talked to foreign editor Chris Dooley about the rise of Spanish far-right party Vox. To listen, click here]

Any signs of the rancour which had come to characterise relations between the two parties disappeared as the two men embraced on announcing the deal on Tuesday.

Mr Iglesias described it as “the best vaccine against the far-right”. The hard-line nationalist Vox party made the most gains on Sunday, becoming the country’s third political force.

Parliamentary arithmetic

The success of the Socialist-Podemos initiative is still far from guaranteed, given parliamentary arithmetic. With both parties having lost some ground in Sunday’s election, they together total 155 seats in the 350-seat Congress. To win an investiture vote, they would also need the support of an array of smaller regional parties and the abstention of pro-independence Basque and Catalan parties, with whom Mr Sánchez is reluctant to negotiate.

The published agreement contains 10 broad priorities for a new administration, including job creation, fighting climate change and promoting gender equality. It also focuses on Catalonia, where the long-standing territorial crisis has flared up again in recent weeks. On Tuesday, French police dispersed hundreds of Catalan pro-independence demonstrators who had been blocking a main road between Spain and France.

The document agrees to “encourage dialogue in Catalonia, seeking formulas of understanding and engagement, always within the constitution”.

That statement of intent failed to win over the pro-independence Together for Catalonia party (JxCat), whose abstention Mr Sánchez might require in an investiture vote.

“As long as there are [pro-independence] prisoners, exiles and the right to self-determination is not accepted, we cannot support or allow the investiture of Pedro Sánchez,” said Laura Borràs, spokeswoman for JxCat.

Meanwhile, the agreement with Podemos would appear to quash speculation of a “grand coalition” between the Socialists and the conservative Popular Party (PP). “A radical government is the last thing Spain needs,” PP leader Pablo Casado said of the deal.