Spain's ruling Socialist party has won Spain's third general election in four years, but has fallen well short of a majority, a voter survey suggests.
Prime Minister Pedro Sánchez's party is set for 28.1 percent and would need the support of radical left Podemos and Catalan nationalists to form a government.
For the first time since military rule ended in the 1970s, the far-right Vox party is set to enter parliament.
Vox opposes multiculturalism, feminism and unrestricted migration.
The party is predicted to win 12.1 percent of the vote, which would give it up to 38 seats in the 350-seat parliament.
The Socialist prime minster has presented himself as a bulwark against the far right's advance.
The telephone survey of 12,900 voters, revealed as polls closed, was carried out in the days before the election instead of an exit poll. Exit polls have been inaccurate in the past.
RTVE predicted the Socialists would win between 116 and 121 seats while its former coalition partner Podemos was heading for 42-45 seats.
That would leave the two parties short of the necessary 176 for a majority, and requiring the support of Catalan pro-independence parties and Basque nationalists.
Almost all votes are expected to be counted by midnight.
What are the key 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 declared its independence from Spain weeks later.
A dozen of its leaders have since gone on trial in Madrid, facing charges including rebellion and sedition.
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, however, has spoken out against what it calls "radical feminism" that it claims "criminalises" men.
What are the candidates saying?
Speaking after casting his vote at a polling station near Madrid, Mr 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".