Sanchez, whose Socialist Workers’ Party (PSOE) won 123 seats in an election in April but fell short of an absolute majority, needs to secure the support of Podemos in order win a second, decisive vote on Thursday.
He also requires support from smaller, regional parties as he needs a full majority of at least 176 of 350 votes to be confirmed as prime minister.
On Tuesday he lost by 170 votes to 124, with 52 abstentions.
If he manages to form a coalition government, it would be the first in post-dictatorship Spain.
But Podemos and regional parties that could back Sanchez have accused him of failing to reach out to possible allies despite needing their help.
The PSOE has been locked in negotiations with Podemos for months and only recently reluctantly agreed to form a coalition government with them.
In a parliamentary debate on Monday, Podemos leader Pablo Iglesias accused the socialists of refusing to offer his party significant positions and wanting them to be “mere decor” in the government.
“We have to talk about content, we have to talk about programmes, and not so much about who will occupy the blue seats,” Sanchez retorted on Tuesday, regarding the places reserved for the cabinet in parliament.
Podemos’s 42 legislators abstained in the vote.
Catalan separatist party ERC, meanwhile, accused Sanchez of being “irresponsible” for not appearing to want to negotiate with anyone.
It also slammed him for not having mentioned the separatist crisis in Catalonia in his address to parliament on Monday.
ERC had previously said it would not stand in Sanchez’s way despite their differences over how to handle the Catalan crisis, which culminated in a failed declaration of independence in October 2017.
But Gabriel Rufian, ERC’s leader in parliament, said “the feeling was that you are playing poker with the hopes of hundreds of thousands of people who came out to vote on April 28”.
ERC voted against Sanchez on Tuesday.
Aitor Esteban of the PNV Basque nationalist party said the socialists had not even been in touch with them in the past few weeks.
“They have taken for granted that our vote was going to be positive,” he said. His party also abstained in Tuesday’s vote.
If Sanchez is not confirmed as prime minister on Thursday, he or another party leader would have two months to find parliamentary support, failing which the Spanish would face another general election.
“While minority governments are a common occurrence in Spain, coalition governments are not, which explains PSOE’s reluctance to share power,” Federico Santi, Spain analyst at consultancy Eurasia Group, told AFP news agency.
“This is the latest sign of the many outstanding issues that remain to be addressed and continued animosity and lack of trust between the two parties,” he said.
“However, the uncertainty around new elections, and pressure from both parties’ base to avoid an electoral repetition suggests an agreement is ultimately likely, if not this week than later this summer.”