Just two years ahead of general elections, Spain's right-wing opposition has set its sights on repeating its Madrid triumph on a national scale, sounding a warning to Pedro Sanchez's leftist government.

Although the electoral success of the right-wing Popular Party was never in doubt, the scope of its win in Spain's richest region dealt a heavy blow to the prime minister's Socialist party and its left-wing allies.

Thanks to a populist campaign focused on her refusal to impose tight restrictions on the local economy, Madrid's hardline leader Isabel Diaz Ayuso won by a landslide, with the PP securing 65 of the regional parliament's 136 seats, more than double its showing in 2019.

The scope of the People's Party (PP) win in Spain dealth a heavy blow to the leftist government
The scope of the People's Party (PP) win in Spain dealth a heavy blow to the leftist government AFP / PIERRE-PHILIPPE MARCOU

But falling just short of an absolute majority of 69, she will need the support of the far-right Vox to govern.

For Sanchez, however, the campaign has been a disaster. Personally involved since the start, his Socialist party suffered a major drubbing, shedding 13 seats to end up with 24, the same number as the hard-left upstart Mas Madrid.

Equally hard hit was the far-left Podemos, Sanchez's junior partner in government, whose leader Pablo Iglesias announced his withdrawal from politics after the left's three parties collectively secured fewer seats than Ayuso's PP.

People's Party (PP) candidate Isabel Diaz Ayuso declared after her victory that the leftwing government's "days are numbered"
People's Party (PP) candidate Isabel Diaz Ayuso declared after her victory that the leftwing government's "days are numbered" AFP / PIERRE-PHILIPPE MARCOU

Although the PP has ruled Madrid for 26 years, the party was ousted from Spain's national government three years ago and is now hoping it will be able to replicate its regional success across the rest of the country.

The leftwing government's "days are numbered", declared a triumphant Ayuso in her victory speech on Tuesday night.

Spain has been gripped by instability ever since center-right party Ciudadanos exploded onto the political scene
Spain has been gripped by instability ever since center-right party Ciudadanos exploded onto the political scene AFP / PIERRE-PHILIPPE MARCOU

"Today begins a new chapter in the history of Spain."

For Jos? Ignacio Torreblanca, a political analyst at European Council on Foreign Relations, the result was "a vote of no confidence in Sanchez and Iglesias.. and in (their) coalition government" which took office in January 2020.

With Spain badly hit by the coronavirus crisis, suffering 78,000 deaths from more than 3.5 million cases, Ayuso had managed to "very successfully capitalise on the pandemic fatigue," he said.

Spain's Podemos leader Pablo Iglesias resigns from politics after his hard-left party and the Socialists, who serve together in government, suffered a stinging defeat at the hands of the right in Madrid's regional elections.
Spain's Podemos leader Pablo Iglesias resigns from politics after his hard-left party and the Socialists, who serve together in government, suffered a stinging defeat at the hands of the right in Madrid's regional elections. AFPTV / Rebeca MAYORGA

All eyes are now on the PP to see if it can replicate its regional success at a national level in the general elections of 2023.

"We're now starting to set the stage for a general election and after what happened yesterday, it's a scenario in which the right has the upper hand," said Oriol Bartomeus, a political scientist at Barcelona's Autonomous University.

For now, national polls put Sanchez's Socialist party ahead of the right-wing opposition.

But the PP "will launch a campaign to convince the electorate that we're entering a new phase, that the left-wing era is over and that now it's the turn of the right," he said.

Since the early 1980s, the two rival parties have been alternating in government, with the Socialists in power from 1982-1996, then 2004-2008 and since 2018, and the PP ruling between 1996-2004 and 2011-2018.

What secured Ayuso's victory was the collapse of Ciudadanos, the center-right party, whose 26 mandates evaporated this time around, with its voters snapped up by the PP.

When Ciudadanos exploded onto the political scene in 2015 alongside fellow upstart Podemos, it transformed Spain's political landscape, shattering three decades of bipartisan hegemony by the Socialists and the PP.

Since then, Spain has been gripped by huge instability, with the PP and the Socialists unable to secure an absolute majority in a deeply fragmented political environment that pushed them to broker complex parliamentary alliances.

And that heralds "a change in the landscape" which sets the scene for the 2023 elections, he said.