By Sam Edwards and John Stonestreet
MADRID (Reuters) - The leaders of all of Spain's main political parties invited their supporters on Friday night to prepare for power, as campaigning for one of the tightest national elections in decades drew to a close.
No single party will get an overall majority in Sunday's ballot, and opinion polls suggest all five leading contenders have a realistic chance of playing a role in government.
Divisive and often ill-tempered, the election has been fought mainly on emotive topics - notably issues of national identity linked to Catalonia's drive for independence - with the economy taking a rare back seat.
With campaigning having ended at midnight, party leaders remained mostly non-committal about potential alliances after the vote - though Spain's political landscape has effectively coalesced around two distinct electoral blocs, one on the left and the other on the right.
Outgoing Socialist Prime Minister Pedro Sanchez - who made overtures to far-left Podemos during a televised debate on Tuesday - cited U.S. President Donald Trump in warning supporters against allowing a right-wing alliance to take office.
That would be formed of three parties and include radical newcomer Vox, part of a broader far-right movement that has already entered government in some European countries, notably Italy.
"No one gave Trump any chance of becoming president and he is. No one thought (far-right Jair) Bolsonaro would become president of Brazil, and he has," Sanchez told a crowd of around 3,000 in the working class Madrid suburb of Vallecas.
Under the most optimistic scenario for the Socialists, Sanchez could stay on as leader of the euro zone's fourth largest economy with just Podemos as an ally.
But most polls have shown them likely to need backing from smaller nationalist parties, notably from Catalonia, which would seek concessions that Sanchez - labelled a traitor by the right for being open to dialogue with secessionists - might find hard to swallow.
The Socialist leader has consistently refused to discuss the issue of Catalan independence.
Official opinion polls ended on Monday, with up to four in ten voters still undecided.
Since then, informal soundings by media organisations suggest voters' intentions may have shifted, with Vox the possible beneficiary.
That has raised the prospect of the rightist coalition, which would also include centre-right Ciudadanos, winning enough votes to form a majority - though many view a deadlocked parliament and fresh elections as the likeliest option.
The main rightist challenger, Pablo Casado of the conservative PP party, said his party was the best option for removing Sanchez from office, and urged those on the right to vote tactically.
"If we want Spain to stay unified we need to unify our forces," he told the PP rally in Madrid. "Only we can lead this movement of change... and we must use our heads to think about who we vote for."
Sanchez and Ciudadanos, at one time viewed as potential allies with possibly enough votes to govern in tandem, have progressively distanced themselves from each other as the election has neared.
On Friday, Ciudadanos leader Albert Rivera appeared to end that prospect for good. "We were born to kick out Sanchez and people like him ... and we were born to govern Spain," he told supporters in the east coast city of Valencia.
His speech mentioned those he said wanted to "break" Spain, an apparent reference to Sanchez's offer of dialogue with Catalan separatists.
That chimed with sentiments expressed by Vox leader Santiago Abascal, who was sent best wishes via Twitter from Italy's right-wing League leader and Deputy Prime Minister, Matteo Salvini.
Abascal told his party's rally in central Madrid: "We won't allow the destruction and the suicide of Spain... we are going to drive the traitors out of the Moncloa (government) Palace."
At the other end of the political spectrum, Podemos leader Pablo Iglesias set out his own notion of nationhood.
"Defending Spain means defending the public system. No jumped-up pseudo-patriot with (former British Prime Minister Margaret) Thatcher's ideas... is going to give us lessons on what it means to be Spanish," he told supporters in Madrid.
(Reporting by John Stonestreet in Madrid and Sam Edwards in Barcelona, Editing by Rosalba O'Brien)