Apart from the 123 lawmakers of his Socialist party, just one other deputy from a regional grouping voted for Sanchez, leaving him far short of the simple majority he needed.
“I am very sorry to note that parliament remains blocked,” the socialist premier told the lower house ahead of the vote, adding that a deal for a coalition government with the far-left Podemos party had “not been possible.”
Failure to get the necessary backing moves Spain a step closer to holding its fourth such polls in as many years.
Spain faces several challenges for which it needs a stable government: an ongoing separatist movement in its northeastern region of Catalonia, high unemployment, low wages and job insecurity.
After Sanchez loses the confidence vote he will have another two months to find ways of getting support, either for a minority or coalition government.
Without a deal Spain would have to go back to the polls in November.
The confidence vote follows an inconclusive general election which Sanchez won without a majority.
❌ #SesiónDeInvestidura Con 124 votos a favor, 155 en contra y 67 abstenciones, el #Pleno rechaza la investidura de Pedro Sánchez. Los diputados tienen dos meses a partir de la primera votación; si no, las Cámaras serán disueltas.
— Congreso (@Congreso_Es) July 25, 2019
What went wrong?
Representatives from both parties had been working to secure a deal for what would be Spain's first post-dictatorship coalition government. But talks stalled on Wednesday evening.
On Thursday, Deputy Prime Minister Carmen Calvo who led the socialist's negotiations said Podemos's demands for government posts were “unrealistic,” accusing the far-left party of wanting “a parallel government” of its own.
Podemos leader Pablo Iglesias “wanted to enter government to control the government,” Sanchez told parliament, despite coming fourth in the April general poll.
He said Podemos's proposal entailed “controlling 80 percent of government expenditure.”
Iglesias retorted that Sanchez had done little to negotiate a government since the April general poll.
“It's very difficult to negotiate in 48 hours what you didn't want to negotiate in 80 days,” he said.
Both sides had agreed to give Podemos the post of deputy prime minister with responsibility for social issues and the health ministry.
But Podemos also wanted the science and labour ministries, which the Socialist party (PSOE) refused, preferring to give it the housing and equality ministries.
Sanchez needs a simple majority in the vote but cannot win it without the support of Podemos, which with its partner United Left has 42 lawmakers.
End of the two party system
The Socialist premier came first in a national poll in April with just 123 parliamentary seats out of 350, forcing him to seek backing elsewhere.
Since 2015, Spain has shifted from a two-party system to a deeply fragmented parliament with the emergence of Podemos, liberal party Ciudadanos and more recently far-right Vox.
That has resulted in minority governments which have been unable to get any major reforms through, and Sanchez was forced to call early elections in February when his draft budget was rejected.
Apart from Podemos's vote, Sanchez also needs the backing of several other lawmakers from regional parties who had conditioned their support — by a vote in favour or an abstention — on a deal with Podemos.
But even the abstention of key Catalan and Basque separatist parties wasn't enough, as right-wing parties said they would vote against Sanchez.
Podemos and the Socialists have accused each other of blocking negotiations as distrust between both sides rides high.
Gabriel Rufian, Catalan separatist ERC party leader in parliament, blasted both sides for failing to reach an agreement and said Sanchez and Iglesias would regret it.