Mr Sanchez taking office today quickly put an end to seven months of direct rule from Madrid by Spain's central government after it was imposed by the 46-year-old predecessor conservative Mariano Rajoy.
Last night Maria Dolores de Cospedal, the secretary general of the PP, denied persistent rumours that Mr Rajoy would resign ahead of the vote, speculation fuelled by the fact that he did not attend the afternoon session of the debate on Thursday.
All major parties have called for Rajoy to step down, but the prime minister has fended off pressure saying that political instability is bad for the country and for the economies in Spain and the European Union.
"It has been an honour to leave behind a better Spain than the one that I found when I took over government".
Sanchez appeared to have the absolute majority in the Congress of Deputies - 176 of 350 seats - required to unseat Rajoy.
His arrival at the prime minister's office represents an astounding comeback for the man who led the Socialists to two crushing general elections defeats in 2015 and 2016, and was forced out by the party apparatus.
Rajoy earlier charged that Sanchez and the Socialists could not win at the polls and so sought the no-confidence vote as the only path to power.
A veteran politician who has survived many crisis, he insisted he meant to serve his four-year term, ruling out an early election he said would be damaging for the strong economic rebound Spain is enjoying after a deep crisis.
"The facts proved in the sentence show that the president didn't tell the truth", Socialist Margarita Robles told parliament on Friday. PNV's decision on Thursday to support Sanchez's motion to oust Rajoy sent Spain into a frenzy, as pundits and politicians realised the government was doomed to collapse.
Pablo Iglesias, the leader of the anti-austerity party Podemos, said his group was willing to serve in Sanchez's administration and urged him to form a government with the forces that had backed him.
The key is in the hands of the Basque Nationalist Party, or PNV, which made a decision to back Sanchez with its five lawmakers in the national parliament after the Socialist leader vowed to keep the hefty benefits that the Basques obtained in the recent negotiations of the 2018 national budget.
Trained as a lawyer, Rajoy turned to politics at a young age, joining the Popular Alliance, the party founded by ministers of former dictator Francisco Franco which later became the PP. The vote, which required a simple majority, ended with 180 in favor of ousting Rajoy, 169 against and one abstention.
Sanchez has pledged to hold elections at an unspecified future date, but in the meantime the Catalan crisis will surely be near the top of the interim leader's to-do list.
"I don't want a corruption-marred "zombie government" but neither a "Frankenstein government" with those who want to break Spain apart", Rivera said.
Podemos and another newcomer, centre-right Ciudadanos, have said they were ready to present a new no-confidence motion with a candidate for Prime Minister whose brief would be to dissolve parliament and call a snap election.