Spain's Socialist chief Pedro Sanchez

Spain's Socialist chief Pedro Sanchez failed Wednesday in his bid to form a new government and end weeks of political stalemate after both main rival parties voted against him in a vote of confidence.

He was defeated with 219 votes against, 130 in favour and one abstention. 

Sanchez, whose party came second in an inconclusive general election on December 20, will face a second vote on Friday in which he just needs more votes in favour than against in order to become prime minister.