A total of 124 lawmakers in the 350-seat parliament voted for the Socialist premier, leaving him well short of the absolute majority he needed.
Another 170 MPs voted against and 52 abstained. Four remaining votes belong to suspended lawmakers.
❌ #SesiónDeInvestidura Con 124 a favor, 170 votos en contra y 52 abstenciones, el #Pleno rechaza la investidura de Pedro Sánchez. Al no alcanzar la mayoría absoluta necesaria, el jueves se realizará una segunda votación.
— Congreso (@Congreso_Es) July 23, 2019
A second, decisive vote has been scheduled for Thursday afternoon, before which Sanchez needs to reach a coalition deal with far-left Podemos, a party that was once an arch-rival.
Sanchez is currently caretaker premier after coming first in the April general election but without the majority he needed with just 123 seats, forcing him to look for support.
If he manages to form a coalition government, it would be the first in post-dictatorship Spain.
In debates on Monday and Tuesday ahead of obligatory post-election parliamentary votes this week, Podemos and regional parties that could back Sanchez accused him of not reaching out to possible allies despite needing their help.
The second vote on Thursday requires only a simple majority.
With the support of far-left Podemos's 42 lawmakers, and a few others from small regional parties, he could get through.
But given the anger of these potential allies, that support looks uncertain.
Sanchez's Socialist party has been locked negotiations with Podemos for months and only recently reluctantly agreed to form a coalition government with the party.
But Podemos leader Pablo Iglesias angrily lashed out at Sanchez in the parliamentary debate on Monday.
He accused the socialists of refusing to give his party positions that carry any kind of weight and wanting them to be “a mere decor” in the government.
In Tuesday's vote, Podemos lawmakers abstained.
- 'We don't want you': Spain's PM rejects far-left Podemos for new government
- ANALYSIS: Can Pedro Sanchez win backing for second term?
- Spain could have a government by July 23rd (or face new elections)
Catalan separatist party ERC, meanwhile, accused Sanchez of being “irresponsible” for not appearing to want to negotiate with anyone.
He also slammed him for not having mentioned the separatist crisis in Catalonia in his Monday speech to parliament.
ERC had previously said it would not stand in Sanchez's way despite their differences over how to handle the crisis.
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 28th.”
ERC voted against Sanchez 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.
“You're the one who should be looking for alliances,” he told Sanchez. His party also abstained in Tuesday's vote.
If Sanchez cannot secure the votes he needs, he has another two months to find a solution, failing which the Spanish will face another general election.
“What we are seeing in Spanish politics is effectively the natural tensions that occur as a political system transitions from an old way of operating (single-party governments) to what appears to be the new normal…(coalition governments),” said Alfonso Velasco, analyst at the Economist Intelligence Unit.
“Spain might need another election for politicians to accept the new reality.”