The centre-left Socialist Party (PSOE) won the Spanish general elections in April, but couldn't rally a majority in the parliament.
To be named prime minister during the investiture vote on July 22 and 23, Pedro Sanchez must win at least 176 votes - an absolute majority - in the 350-seat Spanish lower house of parliament.
If he fails to do so, the chamber will vote again within two days. In this vote he will need only a simple majority.
If that second vote fails, Sanchez may call a second investiture vote in September. He can also call a new election.
The far-left Unidas Podemos is the Socialists' most likely ally. Despite its leader Pablo Iglesias and Sanchez again failing on Tuesday to agree on an alliance, the government has said it wants the negotiations to continue.Podemos wants ministerial portfolios in a new coalition government, but Sanchez has so far only offered them junior posts.