The leftist political bloc in Spain held the advantage over its rightist rivals in today's general election, according to a tally of results from the interior ministry with 95% of votes counted.

The Socialists of outgoing Prime Minister Pedro Sanchez led with 123 seats in the 350-seat parliament with the far-left Unidas Podemos on 42 seats, leaving the two parties combined 11 seats short of a majority.

The right-wing mainstream conservative PP party was pegged at just 65 seats, with centre-right Ciudadanos on 57 and far-right Vox on 24.

The leader of Spain's far-left Unidas Podemos party said that he would be open to forming a left-wing coalition government with Mr Sanchez's Socialists.

"I have expressed to him (Sanchez)...our willingness to work towards a coalition government," Pablo Iglesias told supporters in Madrid tonight.

Spaniards cast their votes in numbers close to record highs in the country's most highly contested election for decades.

"Vox is without a doubt one of the big winners of the night," Narciso Michavila, the head of GAD3 pollsters, said on national television.

Hundreds of people gathered outside Vox's headquarters in Madrid as the vote was counted waving Spanish flags and cheering.

"They said it was impossible for us to get here, and we've done it," said top Vox official Rocio Monasterio, speaking on television from the party's headquarters.

Pedro Sanchez
Prime Minister Pedro Sanchez casting his vote in Madrid this morning

A splintered vote followed by protracted talks to form an administration is becoming a recurrent theme in European politics as voters reject traditional parties in favour of new groups often at the extremes of the political spectrum.

The elections also took place amid Catalonia's continued push for independence from Madrid. 

The region in northeastern Spain was the scene of a secession attempt in 2017 that sparked the country's biggest crisis in decades and caused major concern in Europe.

Since then, the crisis has continued to cast a pall over Spanish politics.

Founded by a former member of the conservative Popular Party (PP), with a strong stance against feminism and illegal immigration, Vox has risen thanks to its hard line against separatists in Catalonia.

Prime Minister Pedro Sanchez was forced to call early elections after Catalan pro-independence MPs in the national parliament, angered at the trial of their leaders in Madrid, refused to give him the support he needed for his 2019 budget.

Right-wing parties have for their part lambasted Mr Sanchez, at the head of a minority government, for his attempts to negotiate with Catalan separatists who still govern the region, accusing him of being a traitor.