Spain's Socialist leader Pedro Sanchez has failed in a first attempt to get parliament's backing to form a government, leaving him two days to secure support to end an eight-month political gridlock.

Mr Sanchez has been acting prime minister since a first inconclusive election in April and November did not produce a conclusive result.

He needed an absolute majority of at least 176 votes in his favour in the 350-seat house to be confirmed as prime minister but failed to get it.

He obtained 166 votes in favour and 165 against, with 18 abstentions, while one MP did not attend.

On Tuesday, Mr Sanchez will only need a simple majority – more "yes" than "no" votes.

He is likely to get that after securing a commitment from the 13 MPs of Catalonia's largest separatist party, Esquerra Republicana de Catalunya (ERC), to abstain.

Earlier this week, Mr Sanchez and Pablo Iglesias, head of the far-left party Unidas Podemos,  restated their intention to form the first coalition government in Spain's recent history.

The two parties together have 155 seats, short of a majority, so Mr Sanchez is reliant on the votes of small regional parties.

In a sign of how close the race could be on Tuesday, a member from the small regional party Coalicion Canaria, Ana Oramas, voted against Mr Sanchez instead of abstaining as her party had agreed on Friday.

During this morning's debate, Mr Sanchez stressed that a Socialist-Podemos coalition would take a progressive approach.

Mr Sanchez and Mr Iglesias have said they will push for tax hikes on high-income earners and companies and also intend to rollback a labour reform passed by a previous conservative government.