Spain’s main party leaders held their final rallies before Sunday’s election, as Socialist Prime Minister Pedro Sánchez said he was confident of defying polls that put the conservative People’s Party narrowly ahead.

“I cannot imagine us losing,” Sánchez told supporters in red T-shirts as he posed for selfies. He accused his rival, Alberto Núñez Feijóo, of planning a coalition with the far right.

Feijóo campaigned in Barcelona and Seville in the final hours, promising a new era of “truth, decency and good governance”. He accused Sánchez of avoiding questions about corruption, rail disasters, immigration and the national debt.

Almost 39 million people are eligible to vote. Commentators expect a high turnout, but most polls have indicated a close result. Spanish electoral law has barred the publication of polls since Monday.

“This time, yes, we're going to do it,” Feijóo told supporters, referring to his failure to form a government three years ago despite winning the most seats. The PP’s narrow polling lead means any government he forms is expected to rely on support from Vox, the anti-immigration party led by Santiago Abascal.

Vox held its final rally in a bull-ring in Valencia. Speaking earlier in Tarancón, south-east of Madrid, Abascal said Sánchez’s government “has betrayed us, he has robbed us and he has lied to us”. Vox hopes to almost double the 33 seats it won three years ago. Its policies include “national priority”, which puts Spanish citizens first for welfare, and “remigration” for foreigners not considered to be contributing to the economy.

The campaign’s final day followed a four-way televised debate the previous night, which exposed Spain’s sharply polarised politics. Housing was a focus: Feijóo said the PP would build a million homes over four years, while Sánchez argued that housing should be a right, not an object of speculation and profit.

The conservatives sought to focus attention on scandals that have overshadowed the Socialists’ term in office. Sánchez and his left-wing ally Ada Colau, who heads Frente Amplio (The Broad Front), emphasised women’s rights.

During the debate, Feijóo accused Colau and the rest of the left of staying quiet during a flood disaster in Valencia and briefly moved his finger to his lips. The word he used, “calladita”, is a diminutive that can also be used condescendingly to tell a woman to “keep quiet”. Sánchez called on him to show “a little respect” and accused him of sexism.

On Friday, Feijóo said he had meant that Colau had remained silent during “these years of corruption”. He chose to end his campaign in Seville, in Andalusia, which has 61 of the 350 seats in Spain’s parliament, more than any other region.

Andalusia is governed by a coalition of the PP and Vox, as are Extremadura, Aragón and Castilla y León. Feijóo has said he wants to govern with a majority, supported by “parliamentary support agreements” with Vox. He says he has never spoken to Abascal about giving the party ministerial power.

Sánchez appeared on stage in Madrid with his wife, Begoña Gómez, wearing a red T-shirt that read “power of the people”. He praised Colau and her coalition’s campaign. Speaking to a large audience in the south of Madrid, Colau said they would “not remain silent, we will win” and vowed to form another “progressive government”.

The Socialist leader heads one of Europe’s few left-wing governments. With French presidential elections five months away, the article says two of the continent’s biggest economies could move to the right in quick succession.