The ruling Socialists in Spain won most of the vote in Sunday's general elections, but failed to secure enough seats to form a government, with the far-right party making a spectacular breakthrough to become third force of the national parliament.

While exhausted voters went to the polls for the fourth time in as many years, the left and right parties had failed to get enough combined seats to break the political stalemate. which has been rife in the country since 2015.

With 99% of the votes cast, the center-left interim government won 28.1% of the vote, but lost three seats, from 123 to 120, which is well below the 176 needed for a majority in the House. bass, which has 350 seats. .

Vox, the far-right party that burst onto the national scene just six months ago, winning 24 seats in inconclusive elections in April, has more than doubled the number of its deputies, which is increased to 52.

Santiago Abascal, the leader of Vox, said he wanted to build a "patriotic alternative" for the country while he was greeted by an enthusiastic crowd in Madrid.

Spanish Prime Minister in office and Socialist Party (PSOE) candidate for re-election, Pedro Sanchez, celebrates his victory on the electoral night in Madrid (AFP via Getty Images)

The secessionist crisis in Catalonia had fueled support for Vox in view of the elections.

There were mass demonstrations and violence on the street for three weeks last month after nine separatist leaders were sentenced to up to 13 years in prison for sedition.

The traditional conservative Popular Party (PP), which had suffered a historic setback in the last election by winning only 66 seats, had its share of the vote increase by 87 seats.

Vox and the PP took advantage of the collapse of the liberal Ciudadanos (citizens), who won only 10 seats, a dramatic fall from the last elections, where he ranked third with 57 seats.

After the last elections, Ciudadanos first rejected a coalition with the Socialists, then seemed to consider the possibility of an alliance, thus raising the suspicion of the voters.

The Socialists have the best chance to regain power, but will have to forge a fragile alliance with the far left party Unidos Podemos (United We Can), which saw its deputies fall from 42 to 35, a new party of the left , Mas País (More Country), smaller regional parties and separatist parties Left Catalan Republican (ERC) or Together for Catalonia (JxCat).

Such an alliance can be risky. The separatists withdrew their support from the Socialist government's budget in February, at the origin of the last elections.

Pablo Iglesias, the UP leader, hinted that his party would be ready to help Spanish Socialist Prime Minister Pedro Sánchez form a government.

Sanchez said he would call the other party leaders as of Monday to tackle a political stalemate, adding that he hoped to form a stable and "progressive" government.

Electoral Commission members count votes in the general election in Spain at a polling station in Madrid, Spain (REUTERS)

"We will give a hand to the Socialist Party. We believe that by combining the courage of United We Can and the experience of the Socialist Party, we can turn our country into a point of reference for social policies, "he said while voting.

"We will leave the blame."

Attempts to form a left-wing coalition between the two parties in July failed, with the leaders of these parties harshly reproaching each other.

The increase in support for Vox was perceived as a protest by voters against the government alleged to be unable to handle the weeks of riots in Catalonia.

"I've always voted for a traditionally conservative PP, but this time I voted for Vox. I have enough that the government has not repressed what happened in Catalonia. They seem to be scared, "said Juan Goytisolo, 27, an economist in Malaga.

In Catalonia, others felt anger at the imprisonment of secessionist leaders and supported separatist parties.

Supporters of the Spanish far right party VOX when waving flags during the parliamentary elections in Spain, in front of the party headquarters in Madrid, Spain (REUTERS)

"I do not support independence but this time I voted for ERC. These sentences were scandalous, "said Dolores López, 53, a computer engineer from Barcelona.

Pablo Simón, political expert at the Carlos III University of Madrid, said: "There are probably only two options for forming a government: the Socialists could team up with Podemos with the help of small parties and separatist parties. Or the right-wing parties could abstain and allow the Socialists to form a minority government.

"It seems that the second option is less likely, because the right-wing parties, like the PP, would demand something in return from Sánchez."

He added that if no agreement could be found to break the stalemate, Spain could prepare for a new election after Christmas.

Two people died while voting, while a man was arrested with a gun in a polling station in Catalonia.

Some 37 million Spaniards were allowed to vote but by 18 hours, only 56.8% took the trouble to vote, which is lower than the 60.7% who voted at the same stage in the last elections.

.