Lawmakers on Tuesday begin debating Alberto Nunez-Feijoo's bid to become Spain's next prime minister a day before an inauguration vote the right-wing opposition leader is almost certain to lose.

Despite winning the most votes in July's inconclusive election, the Popular Party (PP) leader has no majority to form a government and, barring surprises, will face defeat.

If his bid fails, it will pave the way for outgoing Prime Minister Pedro Sanchez to try his hand at an inauguration vote, which he believes he can pass with support from a hardline Catalan separatist party cast in the role of kingmaker.

Tasked by King Felipe VI with forming a new government, Feijoo will take to the parliamentary podium at midday (1000 GMT) on Tuesday to present the programme that will be put to a vote on Wednesday.

To be sworn in, Feijoo needs an absolute majority of 176 votes in the 350-seat parliament, but he can only count on 172, largely thanks to the support of the far-right Vox, whose extreme positions have left the PP almost totally alienated.

If he fails, Feijoo will then face a second vote on Friday when he will need a simple majority of more votes in favour than against. But there too, he has little to no chance of winning sufficient support.

- 'Blackmail' -

Acutely aware of his lack of support, Feijoo has for weeks been attacking Sanchez's plan to seek support from JxCat, the hardline Catalan separatist party.

JxCat's main demand for its seven key votes in support of Sanchez is an amnesty for hundreds of activists facing legal action over the failed 2017 Catalan separatist bid, which sparked Spain's worst political crisis in decades.

On Sunday, around 40,000 people waving Spanish flags and banners hit the streets of Madrid in protest against the separatists' demand for an amnesty, with Feijoo denouncing the amnesty bid as tantamount to "blackmail".

The PP leader's expected defeat in Wednesday's vote will set in motion a new two-month countdown: if Sanchez cannot pass an investiture vote within that time, Spain will face new elections, most likely in January.

- Amnesty red line -

Approving an amnesty to stay in power would be dangerous for Sanchez as it would affect separatist leaders who fled Spain to avoid prosecution over the independence bid, such as JxCat leader Carles Puigdemont.

An extremely sensitive political issue, approving an amnesty is not only a red line for the right but also for elements within Sanchez's own Socialist Party.

The PP has been seeking to exploit those divisions by urging Socialist lawmakers opposed to the amnesty to reconsider their stance on Feijoo's inauguration.

And this has angered Sanchez who on Sunday accused the party of "encouraging the worst kind of corruption".

Sanchez, who has repeatedly demonstrated his capacity for political survival, is confident he will be returned to power with the support of the far left along with Basque and Catalan regional parties.

"They are demonstrating against a Socialist government," he said of Sunday's protest, "and I'm sorry but there is going to be a Socialist government".