Spain’s ruling Socialist Party (PSOE) has achieved its first election victory since the financial crisis, although it failed to secure an overall majority.

With most of the results confirmed, Prime Minister Pedro Sanchez was assured of securing an electoral mandate, 10 months after he orchestrated a no-confidence vote to take power from the conservative Partido Popular (PP), which looked likely to have suffered its worst ever election result due in part to the rise of far-right Vox.

"The Socialists have won the general election and with it the future has won and the past has lost," Mr Sánchez told supporters from the balcony of the party's headquarters in Madrid.

PSOE is set to win 122 of the 350 seats in Spain’s congress of deputies, with PP winning 65, centre-right Ciudadanos 58, left-wing Unidas Podemos 42 and Vox 24, becoming the first explicitly far-right party to gain representation in Spanish politics since the death of General Francisco Franco in 1975 and the end of military dictatorship.

Vox leader Santiago Abascal, argued that the Socialist success meant his party would become "even more necessary" than before."

Far-right Vox party celebrate gains in Spain election: in pictures Show all 9 1 /9 Far-right Vox party celebrate gains in Spain election: in pictures Far-right Vox party celebrate gains in Spain election: in pictures A supporter of Spanish far-right Vox party chants "long live Spain" in a closing event for the election campaign on April 26 AP Far-right Vox party celebrate gains in Spain election: in pictures Vox leader Santiago Abascal reacts as the election results are announced AFP/Getty Far-right Vox party celebrate gains in Spain election: in pictures Vox leader Santiago Abascal speaks at a rally on election night AFP/Getty Far-right Vox party celebrate gains in Spain election: in pictures Supporters of Vox wait for the announcement of the election results in Madrid Reuters Far-right Vox party celebrate gains in Spain election: in pictures Supporters of Vox wave flags as leader Santiago Abascal delivers a speech on election night AFP/Getty Far-right Vox party celebrate gains in Spain election: in pictures Supporters of Vox celebrate following the election results in Madrid AFP/Getty Far-right Vox party celebrate gains in Spain election: in pictures Supporters of Vox wait for the announcement of the election results in Madrid Reuters Far-right Vox party celebrate gains in Spain election: in pictures Supporters of Vox wait for the announcement of the election results in Madrid Reuters Far-right Vox party celebrate gains in Spain election: in pictures Vox leader Santiago Abascal reacts as the election results are announced Reuters

The result leaves neither of the proposed coalition blocs likely to reach the 176 seats required for an overall majority.

Ciudadanos leader Albert Rivera reiterated that his party will not try to form a work with the Socialists, promising to be an opposition party "loyal to Spain's Constitution."

However, PSOE and Podemos find themselves 11 seats shy of the opportunity to set up a progressive partnership on their own.

Speaking before election day, Mr Sanchez admitted that a coalition would probably be the only way forward.

Opening the door for Podemos and refusing to rule out working with Ciudadanos, he said: “My commitment is to talk to all political parties, within democracy ... Democracy is not ‘vetocracy’.”

Nevertheless, the former basketball player will now need the consensus of several parties to form a stable government, following one of Spain’s most acrimonious election build-ups since its transition to democracy.

The fracturing of the right pushed Mr Sanchez onto the defensive for much of the campaign as opposition parties – with retired Francoist generals, bullfighters and marquises among their top candidates – competed to adopt the most aggressive stance against socialists and Catalan nationalists.

His PSOE may struggle to agree a coalition with Ciudadanos, the most moderate member of the conservative triumvirate, which has accused the prime minister of being a “felon”, “traitor” and “compulsive liar”. At December’s Andalusian regional election, it entered a coalition involving Vox.

Hung parliaments in Spain have traditionally spawned minority governments, relying on the confidence and supply of Basque and Catalan parties, both initially supportive of Mr Sanchez’s swoop to office last June.

However, Catalan separatists, who in effect forced the election by rejecting the Socialist budget in February, will this time demand an independence referendum, which the prime minister has vowed “will never take place”.

Despite all sides calling for national unity, differences persist and the prospect of a fourth general election in as many years endures.

The bursting of a 15-year bubble that began Spain’s financial crisis of 2008 to 2014 signalled the end of a two-party system that had predominated for decades.

Support free-thinking journalism and attend Independent events

The resulting austerity galvanised the then anti-capitalist Podemos, while a corruption scandal engulfing former prime minister Mariano Rajoy’s PP government, as well as its handling of Catalonia, gave rise to Ciudadanos.

In the wake of attempted dialogue on Catalan independence, reforms aimed at protecting women from sexual violence and an increase in immigration to the Mediterranean coast – the dramatic arrival of Vox has changed the face of Spanish politics.

It could yet still be part of a coalition government.