Spain’s ruling Socialists are on course to be the biggest party in the third election in four years, but have fallen short of a majority.
PM Pedro Sánchez’s party is set to win under 29% and would need the support of left-wing Podemos and possibly Catalan nationalists to form a government.
For the first time since military rule ended in the 1970s, a far-right party is set to enter parliament.
Vox opposes multiculturalism, feminism and unrestricted migration.
- Socialists battle to stop right-wing surge
- Pedro Sánchez: Spain’s accidental PM on a roll
With most of the results in, the party was on more than 10% of the vote, which would give it 24 seats in the 350-seat parliament.
The Socialist prime minister has presented himself as a bulwark against the far right’s advance.
According to the results the Socialists are set to win 122 seats while their former coalition partner Podemos would have 42.
That would leave the two parties short of the necessary 176 for a majority, and requiring support from Catalan pro-independence parties and Basque nationalists.
The centre-left Catalan ERC was the big winner in Catalonia, with a projected 15 seats. Its leader, Oriol Junqueras, is in jail for his role in declaring independence in October 2017.
Mr Sánchez had to call the election when Catalan MPs withdrew their support last month.
The Popular Party (PP), which ruled Spain until it was dumped from power in May 2018 in a no-confidence vote, is heading for its worst election ever, with just 65 seats.
That would leave the PP far short of forming a coalition with centre-right Ciudadanos (Citizens) and Vox.
Almost all votes are expected to be counted by midnight.
Who are Vox?
Led by Santiago Abascal, a former member of the conservative PP, the party has emerged in a matter of months with a vow to “make Spain great again”.
It won seats for the first time in local elections in the southern Andalusia region, and agreed to support a centre-right coalition of the PP and Ciudadanos.
- Nationalists vow to ‘make Spain great again’
Vox rejects the far-right label but its views on immigration and Islam place it in line with far-right and populist parties elsewhere in Europe.
It wants to repeal laws against gender violence, and opposes abortion and same-sex marriage. Critics see it as a nationalist throwback to fascist dictator Francisco Franco, who ruled Spain until his death in 1975.
Vox aims to deport migrants legally entitled to be in Spain if they have committed an offence, and wants to prevent any migrant who comes in illegally from staying.
What were main election issues?
The highly polarised campaign was dominated by issues including national identity, gender equality and the future of Catalonia.
The semi-autonomous region held an independence referendum in October 2017 and then declared its independence from Spain.
A dozen of its leaders have since gone on trial in Madrid, facing charges including rebellion and sedition. Mr Junqueras was Catalan vice-president when he was arrested.
- Catalan crisis in 300 words
- Spain country profile
Analysts say support for Vox has been boosted by widespread anger at the independence drive. The party fervently opposes any concessions to the secessionists.
Women’s rights have also been a key campaigning topic. Gender-based violence has provoked debate and street protests across Spain for years and more politicians than ever are courting women’s votes.
Vox has spoken out against what it calls “radical feminism”, saying that it “criminalises” men.
Where do the parties stand on key issues?
What the leaders said
Speaking after casting his vote at a polling station near Madrid, Prime Minister Sánchez said he hoped for stability.
“After many years of instability and uncertainty, it’s important that today we send a clear, defined message about the Spain we want. And from there a broad parliamentary majority must be built that can support a stable government,” he told reporters.
Meanwhile, Albert Rivera, leader of the centre-right Ciudadanos, renewed calls to oust Mr Sánchez as he cast his vote in Barcelona.
“These are not any normal elections. At stake is whether we want to remain united, if we want to continue being free and equal citizens, if we want a Spain that looks to the past or the future, a country of extremes or of moderation,” he said.
Pablo Casado, who took over the leadership of the conservative Popular Party after it was dumped from power in a no-confidence vote in May 2018, said he wanted to see a “stable government” to avoid the “failed legislatures” of the past two years.
Vox leader Santiago Abascal said many Spaniards were voting “without fear of anything or anyone”.