Preliminary results showed the Socialist party (PSOE) of outgoing prime minister Pedro Sanchez coming first and best-placed to form a coalition government against a rightwing bloc split into three parties and weakened by the sudden eruption of Vox, the far-right party that has surged into parliament.
Mr Sanchez and the left have beaten a fissile right that has treated him as a usurper and traitor. And the PSOE has rebounded across most of Spain. But, with official results still to come, he looks just short of a majority in parliament without the politically damaging support of Catalan separatists.
The botched effort by secessionists in Catalonia to win independence in a constitutionally illegal referendum in 2017 has twisted Spanish politics into an identity fight, with Vox reviving themes barely heard since the death of dictator Francisco Franco in 1975.
Rightwing leaders have poured vitriol on Mr Sanchez. Pablo Casado, the new leader of the rightwing Popular party (PP), accused him of “high treason”, and of siding with Catalan separatists who voted with the left in June last year to bring down the PP government led by Mariano Rajoy, after a multi-party vote of censure in parliament triggered by one corruption scandal too many.
The same Catalan secessionists — 12 of whose leaders are on trial for “sedition and rebellion” — brought down Mr Sanchez’s minority government in February by voting alongside the right in parliament against his budget. The Socialist leader now looks to have a narrow path to power without the support of Catalan separatists, who now hint that they are ready to respond to his call for dialogue, even though he rules out independence and calls for clearer devolution of powers within a federal system.
The PSOE and the anti-establishment left Podemos (We Can) party, along with the mainstream Basque Nationalist party (PNV), could be within a whisker of an absolute majority, which needs 176 of 350 seats in parliament. The Catalan secessionists will certainly not vote against Mr Sanchez’s investiture, given the alternative of a rightwing coalition that wants to gut regional autonomy and, in the case of Vox, abolish all home rule as a threat to the essence of Spain.
A subplot in this saga was the recovery of the moribund Catalan Socialist party (PSC), mowed down in the identity wars of the past decade, now restored to life by pervasive fear of what the right might do to the self-government Catalonia already enjoys.
After the breast-beating that has marked this campaign, there should be some soul-searching on the right — all of whose leaders vied with unbridled hyperbole to triumph over each other.
Mr Casado appeared as shallow and shrill in a campaign that has brought the PP to its knees, losing half its seats. Albert Rivera, leader of the ostensibly liberal centre-right Ciudadanos (Citizens) party, lurched recklessly right in a bid — which looks to have failed — to supplant the PP and become prime minister.
Both parties have haemorrhaged votes to Vox, which now that it is inside institutions like parliament must decide whether it wants to be the party of the right or a neo-Francoist provocateur.
When all the votes are counted they will discover they lost a vital edge in the small provinces of Spain’s interior where the right usually has an advantage — as a single force.
They will also realise they have lost their majority in the Senate — a vital weapon against any excess of Catalan or Basque self-government, one of the right’s main issues in this campaign. On the evidence of this contest, it may be unreasonable to expect a statesmanlike rallying round to deal with such matters of state.