Spain's Socialists and the radical left-wing Podemos on Tuesday have agreed in principle to form a coalition government in what would be the first such power-sharing deal in the country's modern history.
The announcement came just days after Spain held its fourth election in as many years, from which Socialist Prime Minister Pedro emerged a winner but weakened, with the far-right Vox transformed into parliament's third-largest party.
But a government formed by the two parties would need the support of other factions to pass an investiture vote because they would be short of the 176 seats needed for a majority in the 350-seat parliament.
The legislature has been mired in deadlock since an inconclusive election in April which the Socialists won but without a majority — in an outcome which was repeated on Sunday.
Sanchez called Sunday's election in the hope of strengthening his hand after months of negotiations between the Socialists and Podemos failed to reach a deal — a gamble that ultimately failed.
Announcing the new tentative deal, Sanchez said the aim was to break months of political deadlock.
"Our desire is to achieve majority support in the chamber," he said, indicating they would approach other factions "to achieve a stable and sustained majority that would make possible not only an investiture vote but a legislature."
Standing next to him, pony-tailed Podemos leader Pablo Iglesias said they wanted to form "a progressive coalition government" and would thrash out the details of both its programme and structure in the coming weeks.
"As election night showed... what was a historic opportunity in April has become a historic necessity," he said of an election which showed a definite shift to the right.
Ciudadanos support sought
Both the Socialists and Podemos lost seats compared to April's election, with Sanchez's party taking 120, down from 123, while Podemos secured 35, down from 42.
With just 155 seats, they are still 21 short for an investiture vote, with the party likely to win support from leftwing upstart Mas Pais with its three seats, as well as several other non-separatist regional parties.
But most important would be the backing of centre-right Ciudadanos, analysts said.
Although the party had previously ruled out any support for Sanchez, it suffered a major rout on Sunday, prompting the resignation of leader Albert Rivera.
"Given the collapse in support for Ciudadanos, whose share of seats fell dramatically from 57 to 10, we believe the party wants to avoid another election and being seen as blocking the formation of a government," the Economist Intelligence Unit (EIU) said.
However, the party would have to actively support the government, rather than abstain, given the likelihood that Catalan pro-independence parties would vote against a Socialist-led government.
But the announcement drew swift criticism from Ciudadanos, which seemed to immediately rule out backing a Socialist-Podemos alliance.
"Ciudadanos cannot support Sanchez and Podemos holding the reins of Spain's government," a party statement said, saying it would be "detrimental to the interests of most Spaniards."
And like others, it harked back to a September interview in which Sanchez justified his decision to call an election and refusal to work with Podemos
In it he said he wouldn't sleep at night if he formed a coalition with a party that had so "little experience of politics."
"Not so long ago, he said he couldn't sleep with the idea of Podemos and now they're going to live together," the party said, in remarks which were echoed by PP leader Pablo Casado.
"It no longer worries him that Pablo Iglesias will be in his government but there are many Spaniards who will be worried by this deal that they've just announced," Casado tweeted.
Following the announcement, the Ibex 35 index of most-traded Spanish shares went into the red, and soon after was trading about 0.80 percent lower, with banking stocks particularly affected on concerns the alliance could hike taxes on the sector.