With fewer MPs between them than prior to last Sunday's election, the Socialist PSOE party and Unidas Podemos (UP) took rapid steps to bury differences and form a coalition government this week.
If personality clashes between the two leaders and failure to agree a split of ministries over the summer had led to this repeat election, this time the two main left-wing groups were taking no chances. The rise of the far-right Vox vote and the spectre of a possible third general election focused minds immediately.
On Tuesday, less than 48 hours after the election, the two leaders, Pedro Sánchez and the UP's Pablo Iglesias, signed a public deal seemingly ending the previous impossibility of working together. Iglesias will get one of three deputy prime minister positions and his UP will control three ministries, probably those with welfare policy portfolios.
However the PSOE and UP together are only 155 seats of the 176 majority required, and acting Prime Minister Sánchez will need the support of the MPs from other, smaller parties in order to be sworn in as PM, or at least secure their abstention.
Key could be the abstention of Ciudadanos' MPs, the Catalan separatist ERC or left-wing Basque nationalist party, Bildu. PSOE representatives have spent the rest of this week talking to smaller parties to try to win their support. In return, all these parties are likely to ask for concessions or favours in next year's budget. The PSOE was said to be trying to secure an investiture vote on a new PM as soon as possible and the first cabinet meeting of the new government by Christmas.
Initially after Sunday's vote, commentators suggested that the conservative PP could either form a grand coalition with its Socialist enemies to get a government moving or abstain to help the PSOE to minority power. So the speed of the Iglesias- Sánchez deal took most by surprise.
Sánchez has persuaded the UP to be more conformist over how to tackle the Catalan question, with both sides promising in their agreement, which was signed in front of media, to find understanding with Catalonia "always from within the Constitution".
Nervous about what level of public spending the UP wants, clauses have been introduced by Sánchez stating that controlling public expenditure "is essential to maintaining a solid and long-lasting welfare state" and that any new social policies or rights will respect Spain's public-spending commitments with the EU.
One of the key policies of the left is to overturn labour-market reform by an earlier PP government, but this isn't mentioned in the deal, and was replaced by the aim of "fighting against job instability".
On Tuesday, Sánchez said, "We're conscious of the disappointment among progressive voters and the public who wanted a stable government and for us to break the deadlock."