To prevent a power vacuum after a no-confidence motion that saw Mariano Rajoy ousted, Spanish law makes the motion's author - in this case, Sanchez - the country's new leader as soon as the king swears him in.
Last week the Madrid-based National Court, which deals with major criminal cases, said it had uncovered a vast system of bribes given to former PP officials in exchange for lucrative public contracts between 1999 and 2005.
Mr Sanchez has pledged to open talks with the separatist leader of north-eastern Catalonia, but opposes any independence referendum.
He earned a stunning victory to return as leader in May a year ago when he won an internal party election against Susana Diaz, the candidate anointed by the party's powerbrokers, including former prime ministers Felipe Gonzalez and Jose Luis Rodriguez Zapatero.
This gives the main opposition Socialist party, which filed the motion, the absolute majority of 176 votes needed for it to pass.
Sanchez said at the exit of the Congress of Deputies that he was aware of the responsibility he is assuming and the complex political moment.
After the vote, Sanchez is expected to be sworn at the weekend and his cabinet appointed next week.
But while Mr Sanchez's appointment could have implications for Catalonia, it is unlikely to rock the status quo in Europe as the new leader of the eurozone's fourth biggest economy is a staunch supporter of the European Union and the shared currency.
By moving into La Moncloa palace, the seat of government in Madrid, Mr Sanchez will recover the spotlight that he had been sorely missing since leaving parliament.
Portugal play goalless with Belgium in World Cup friendly
Vincent Kompany has been named in Belgium's World Cup squad despite picking up an injury on Saturday. Cristiano Ronaldo is enjoying his vacation ahead of the 2018 World Cup in Russian Federation .
"The Socialists have left us with a ruined country and we brought back growth and jobs", he said, adding that Sanchez was trying to put together a "Frankenstein" government that would damage the economy.
Sanchez also had the backing of the chamber's third-largest party, the progressive-populist alliance Unidos Podemos ("We Can", UP), whose 71 MPs all voted for a change in government.
The future of Spain's Prime Minister Mariano Rajoy hung in the balance on Thursday, with Socialist leader Pedro Sanchez a whisker away from forcing him out of office as a debate due to conclude with a no-confidence vote on Friday hotted up.
The Basque Nationalist Party (PNV) says it will support the motion, which may then propel Mr Sánchez into office.
Sanchez became prime minister with only 84 seats for his Socialist Party in the 350-member assembly thanks to support from the hard-left Podemos and smaller nationalist parties. But perhaps more damagingly for Rajoy, they also questioned the prime minister's credibility and other PP witnesses when they said in court that the hidden accounting was unknown to them.
Rajoy went to shake hands with Sanchez after the result was announced. Dozens of people tied to his party have been sentenced to years in prison.
However, with just 84 PSOE deputies in Spain's 350-seat parliament, maintaining that stance may prove hard.
Spain's Socialist Party (PSOE) leader Pedro Sanchez gestures during a motion of no confidence debate at Parliament in Madrid, Spain, May 31, 2018.