Prime Minister Pedro Sanchez’s Socialists have won Spain’s national election, but large gains by the far-right Vox party appear certain to widen the political deadlock.

After a fourth national ballot in as many years and the second in less than seven months, the left-wing Socialists held on as the leading power in the National Parliament.

With 99% of the votes counted, the Socialists won 120 seats, down three seats from the last election in April and still far from the absolute majority of 176 needed to form a government alone.

Spain Election
Santiago Abascal, leader of far-right Vox Party (Andrea Comas/AP)

The big political shift came as right-wing voters flocked to Vox, which only had broken into Parliament in the spring for the first time.

The far-right party led by 43-year-old Santiago Abascal, who speaks of “reconquering” Spain in terms that echo the medieval wars between Christian and Moorish forces, rocketed from 24 to 52 seats.

That will make Vox the third leading party in the Congress of Deputies and give it much more leverage in forming a government and crafting legislation.

The party has vowed to be much tougher on both Catalan separatists and migrants.

Mr Abascal called his party’s success “the greatest political feat seen in Spain”.

“Just 11 months ago, we weren’t even in any regional legislature in Spain. Today we are the third-largest party in Spain and the party that has grown the most in votes and seats,” said Mr Abascal, who promised to battle the “progressive dictatorship”.

Right-wing populist and anti-migrant leaders across Europe celebrated Vox’s strong showing.

Marine Le Pen, who heads France’s National Rally party, congratulated Mr Abascal, saying it was impressive how his work “is already bearing fruit after only a few years.”

In Italy, Matteo Salvini of the right-wing League party tweeted a picture of himself next to Mr Abascal with the text “Congratulations to Vox!” above Spanish and Italian flags.

And in the Netherlands, anti-Islam Dutch lawmaker Geert Wilders also posted a picture of himself and Mr Abascal and wrote “FELICIDADES” — Spanish for congratulations — with three thumbs-up emojis.

Sunday’s results means there will be no end to the stalemate between forces on the right and the left in Spain, suggesting the country could go many more weeks or even months without a new government.

The mainstream conservative Popular Party rebounded from their previous debacle in the April vote to 87 seats from 66, a historic low.

The far-left United We Can, which had a chance to help the Socialists form a left-wing government over the summer but rejected the offer, lost some ground to get 35 seats.

The undisputed loser of the night was the centre-right Citizens party, which collapsed to 10 seats from 57 in April after its leader Albert Rivera refused to help the Socialists form a government and tried to copy some of Vox’s hard-line positions.