Candidates on both the right and left are urging Spain’s voters to choose wisely and keep the far-right at bay in Sunday’s general election.

What those undecided voters do in this tight race will shape the fortunes of the two political blocs that loosely took shape during campaigning that ended on Friday.

With no one party expected to win over 50% of Sunday’s vote, the question becomes which of Spain’s top five parties will join together after the vote to create a governing alliance.

The incumbent Socialist candidate, prime minister Pedro Sanchez, said on Friday he is open to a coalition with the anti-austerity United We Can party, hinting for the first time at a possible centre-left governing deal.

Spain Election Candidates Debate
Popular Party candidate Pablo Casado (Bernat Armangue/AP)

On the political right, which the conservative Popular Party used to dominate but which has splintered into three main groups, the upstart far-right Vox party is making inroads.

Citizens leader Albert Rivera, meanwhile, insists that his centre-right party will only join a governing coalition with the conservatives.

The Popular Party’s new leader, Pablo Casado, is committed to unseating the leftist Mr Sanchez from power but is also battling to stop the far-right from draining votes away from his party, as pollsters are predicting.

“The only alternative to Sanchez is the Popular Party, because we are the only ones that can reach agreements and avoid a deadlock,” Mr Casado told esRadio, warning that Spain’s economy would suffer under a centre-left alliance.

Mr Casado opened the door to some kind of post-election understanding with the anti-migrant nationalists of Vox.

Spain Election Candidates
Santiago Abascal, leader of Spanish far right party Vox (Alvaro Barrientos/AP)

He said the three parties on the political right could potentially “pool” the votes they win, though he did not elaborate.

All candidates were holding closing rallies in Madrid, with Mr Sanchez and Mr Rivera also moving late in the evening to Valencia, where a regional election is also being held on Sunday.

The only certainty as they readied for those final campaign rallies is that a far-right populist party is poised to sit in Spain’s national parliament for the first time since the 1980s, and that an even more fractured political landscape is likely to emerge from Sunday’s election.

Astrid Barrio, a politics professor at the University of Valencia, said the real fight is taking place between the three right-wing parties.

Vox has surged in support, mainly due to a rise in Spanish nationalism that is the direct result of separatist demands in the northeastern Catalonia region.

“The left has not responded to the right’s radicalisation and separatist parties have not even dared to call for an independence referendum as a condition to eventually back Sanchez,” Ms Barrio said, referring to the political crisis in Catalonia that has affected all of Spain.

“The idea of curbing the rise of the far-right has had a moderating effect,” she said.

Spanish law bans media and parties from conducting polls during the final days of campaigning.

But the latest surveys available, published on Monday, showed that a third of Spain’s nearly 37 million voters still have not decided who to vote for.

Mr Sanchez urged Spaniards to cast a “useful vote”, warning that the rise of Vox should not be underestimated.

“We are facing a real risk for the right-wing and the extreme right to come together,” the prime minister said, citing how the Socialist party was unseated late last year by a right-wing pact after 36 years in power in Andalusia, Spain’s most populous region.

Spain Election
Podemos party leader Pablo Iglesias delivers a speech in Barcelona (Emilio Morenatti/AP)

A close election result could bring a spell of political hard bargaining, and Mr Sanchez said he didn’t want any government he leads to depend on the votes of small parties demanding regional independence, such as those in Catalonia, because they are “untrustworthy”.

“Spain deserves four years of stability,” he said, after what will be the country’s third parliamentary election in less than four years.

Mr Sanchez told the El Pais newspaper that “it isn’t a problem” if the left-wing United We Can party led by Pablo Iglesias becomes part of his Cabinet if he wins the tight race and forms the next coalition government.

Long queues of people registering their early votes could be seen Friday at post offices in Madrid before a mid-day deadline.

Spanish postal service Correos said it had received a record 250,000 votes as of Thursday.