In the wake of the corruption verdicts in the Gürtel affair it was time for Mariano Rajoy to leave the stage. The new socialist government in Madrid has a big opportunity

Spain elected a hung parliament in 2016 and has not had another general election since. So it is tempting to say that one fragile Spanish government has simply been replaced by another after Spanish MPs voted on Friday to dismiss Mariano Rajoy’s centre-right PP in a vote of no confidence. After all, the PP remains the largest single party, with 134 members of the 350-strong Congress of Deputies, while the new prime minister, Pedro Sánchez of the socialists, has only 84, and will be propped up by seven other left and regional parties in key votes.

The temptation to dismiss the change should be resisted. The first reason is that Mr Rajoy, a great survivor who had led Spain since 2011 through a recession and the eurozone debt crisis, deserved to go. Last week a court jailed one of his party’s former treasurers for 33 years for fraud and money laundering and fined the PP itself for benefiting institutionally from kickbacks for public contracts in the so called “Gürtel” affair. Mr Rajoy had testified in the case, in which 29 defendants were jailed. After a corruption scandal on such a scale, it was entirely necessary that the party and its leader should be given their marching orders and a new government formed.

The second reason is that Mr Sánchez has come into office with political momentum on his side. After the 2016 election, in which the socialists lost seats, Mr Sánchez refused to support a new Rajoy minority government, which he accused of corruption. A long socialist party stalemate took place, as a result of which he was forced out of the leadership by moderates, who then abstained to permit Mr Rajoy to take office. A year ago, Mr Sánchez regained the party leadership. Now, in the aftermath of the corruption verdicts, he can claim to have been right all along.

A third reason why Mr Sánchez may hold on longer than the parliamentary numbers may imply is that his chief rival from the left, Podemos, has been faltering recently. The insurgent party’s leader, Pablo Iglesias, has recently survived a confidence vote after being criticised for buying an expensive house outside Madrid, while Podemos has slipped in the polls.

But the big question in Spanish politics is whether the new socialist government and its allies can do what Mr Rajoy conspicuously failed to do and find a solution to the Catalan separatism crisis. Mr Sánchez supported his predecessor’s tough approach last year when Mr Rajoy sacked the Catalan president Carles Puigdemont for holding an illegal independence referendum. But he told MPs in the no-confidence debate this week that he wanted dialogue with Mr Puigdemont’s hardline successor, Quim Torra, providing it did not involve a breach with Spain.

This is a tantalising prospect, and Mr Sánchez would gain further esteem at home and abroad if he could strike a principled bargain with Barcelona. It is desirable that he has the chance. But he knows that any failure could mean an early general election in which, if current polls are to be believed, the initiative could pass to the centrist Cuidadanos party.