Sanchez won Friday’s no-confidence motion with 180 votes in favour, 169 against and 1 abstention.
“I am going to face all our country’s challenges with humility and commitment and, above all, with a lot of determination first, to transform and modernise our country which is what the Socialist Party has always done when we have been in the government,” Sanchez said after the vote.
Socialist party head Sanchez becomes Spain’s seventh Prime Minister since its return to democracy in the late 1970s following the dictatorship of Francisco Franco.
He suggested on Thursday that he would try to govern until the scheduled end of the parliamentary term in mid-2020. But it is unclear how long his administration, with only 84 Socialist deputies in the 350-member legislative assembly, can last.