Early election returns show the Socialist Party of Spanish prime minister Pedro Sanchez running neck-and-neck with the conservative Popular Party.
With just over half of ballots counted, the Socialists were on course to take 129 seats in the lower house of the Madrid-based national parliament.
The Popular Party, which is hoping to win its first national ballot since 2016, appeared poised to win 130 seats, far below pre-election expectations.
The absolute majority needed to form a government is 176 seats.
Polls in Spain’s mainland and the Balearic Islands closed at 6pm local time. Polls on the Canary Islands remained open for one more hour due to the archipelago falling in a different time zone.
Spanish Prime Minister Pedro Sanchez is trying to win a third consecutive national election since taking power in 2018. But his Socialists and the other party in his leftist coalition took a beating in regional and local elections in May.
The mainstream conservative Popular Party led most polling during the campaign and is hoping that its first national victory since 2016 could let candidate Alberto Nunez Feijoo unseat Mr Sanchez. But it may need the help of the far-right Vox party to do so.
Such a coalition would return a far-right force to the Spanish government for the first time since the country transitioned to democracy in the late 1970s following the nearly 40-year rule of dictator Francisco Franco.
Voters braved soaring summer temperatures to cast ballots in the election for 350 members of the lower house of Parliament. Near-final results were expected at midnight.
A PP-Vox government would mean another EU member has moved firmly to the right, a trend seen recently in Sweden, Finland and Italy. Countries such as Germany and France are concerned by what such a shift would mean for EU immigration and climate policies.
Spain’s two main leftist parties are pro-EU participation. On the right, the PP, led by Mr Feijoo, is also in favour of the EU. Vox, headed by Santiago Abascal, is opposed to EU interference in Spain’s affairs.
The election comes as Spain holds the EU’s rotating presidency. Mr Sanchez had hoped to use the six-month term to showcase the advances his government had made. An election defeat for Mr Sanchez could see the PP taking over the EU presidency reins.
Mr Sanchez was one of the first to vote, casting his ballot in a polling station in Madrid.
Commenting later on the large number of foreign media covering the election, he said: “This means that what happens today is going to be very important not just for us but also for Europe and I think that should also make us reflect.”
“I don’t want to say I’m optimistic or not. I have good vibrations,” Mr Sanchez added.
An embargoed tracking poll published by Spanish public broadcaster RTVE on the closing of the voting pointed to an uncertain outcome.
According to the poll, the conservative Popular Party would win the elections with between 145-150 seats. The far-right Vox would get between 24-27.
But they would both have to get results at the high end of those possible outcomes to reach the 176 needed for a majority.
The tracking poll said that Mr Sanchez’s Socialists are heading toward a result between 113-118, not far below the 120 won in 2019. But his path to remaining in power once again would rely on both a new coalition with the leftist Sumar (Joining Forces), tipped to fill 28-31 seats, as well as winning the support myriad small parties, including Basque and Catalan regionalist and separatist parties.
The tracking poll based on 17,500 phone calls was carried out in the two weeks prior to the election. It has a plus or minus 3.5 margin of error.
The Socialists and a new movement called Sumar that brings together 15 small leftist parties for the first time hope to pull off an upset victory. Sumar is led by second Deputy Prime Minister Yolanda Diaz, the only woman among the top four candidates.
Ms Diaz called for everyone to vote, recalling that the freedom to vote didn’t always exist in Spain.
“A lot is at risk,” said Ms Diaz after voting. “For people of my generation, they are the most important elections.”
At stake is “waking up tomorrow with more rights, more democracy and more freedom”.
The Interior Ministry said voter turnout at 6pm local time stood at 53%, compared with 56% at the same point in the the country’s last national election, in November 2019.
The election was taking place at the height of summer, with millions of voters likely to be holidaying away from their regular polling places. However, postal voting requests soared before Sunday.
With no party expected to garner an absolute majority, the choice is basically between another leftist coalition and a partnership of the right and the far right.
Poll favorite Mr Feijoo said: “It is clear that many things are in play, what model of country we want, to have a solid and strong government.”
Vox’s Abascal said he hoped for “a massive mobilisation (of voters) that will allow Spain to change direction.”
Alejandro Bleda, 45, did not say who he voted for but indicated that he was backing the leftist parties. “Given the polarisation in this country, it’s to vote either for 50 years of backwardness or for progress,” he said.
The main issues at stake are “a lot of freedoms, social rights, public health and education,” Mr Bleda said after voting in the Palacio de Valdes public school polling station in central Madrid with his wife and child.
Voters are to elect 350 members to the lower house of Parliament and 208 members to the Senate.
Carmen Acero, 62, who voted for the Popular Party, compared Mr Sanchez to Venezuelan leader Nicolas Maduro and said she voted because “to continue with Pedro Sanchez is hell”.
Ms Acero, who sported a Spanish flag on her phone, accused Mr Sanchez of being an “assassin” for allying with the small Basque regional party Bildu, which includes some former members of the now-defunct armed separatist group, ETA.
She identified “the unity of Spain, employment and security” as among her main concerns.
The government said that all polling stations were running as normal.
A fire in a tunnel forced the suspension of all trains entering and leaving the eastern city of Valencia, indicating many people there might not make it to their voting station.
Coming on the tail of a month of heatwaves, temperatures are expected to average above 35C and to rise between 5C and 10C above normal in many parts of the country on Sunday. Authorities distributed fans to many of the stations.
“We have the heat, but the right to exercise our vote freely is stronger than the heat,” said Rosa Maria Valladolid-Prieto, 79, in Barcelona.
Mr Sanchez’s government has steered Spain through the Covid-19 pandemic and dealt with an inflation-driven economic downturn made worse by Russia’s invasion of Ukraine.
But his dependency on fringe parties to keep his minority coalition afloat, including separatist forces from Catalonia and the Basque Country, and his passing of a slew of liberal-minded laws may cost him his job.
The right-wing parties dislike everything about Mr Sanchez, saying he has betrayed and ruined Spain. They vow to roll back dozens of his laws, many of which have benefited millions of citizens and thousands of companies.