The leader of the Spanish Workers' Socialist Party took over as Spain's prime minister on Friday, after a no-confidence vote spurred by a corruption scandal ousted conservative leader Mariano Rajoy.

Pedro Sanchez won the no-confidence motion with 180 votes in favor, 169 against and one abstention, according to The Associated Press. He could be sworn in to office as soon as Saturday. The report notes that Rajoy's ouster by Parliament is a first for a serving leader in four decades of Spanish democracy.

ADVERTISEMENT

Rajoy's no-confidence vote in Parliament was prompted by a corruption trial that has involved multiple members of his center-right party, and his departure puts Spain into a precarious political landscape, according to NBC News.

"Mr. Sanchez will be the head of the government and let me be the first to congratulate him," Rajoy reportedly told deputies before the no-confidence vote was cast.

The reputation of Rajoy's Popular Party had been hugely damaged after a court verdict said it was a beneficiary of a massive kickbacks-for-contracts scheme. Dozens of people tied to his party have been sentenced to years in prison.

Sanchez has said he hopes to govern until the conclusion of the parliamentary term in 2020. But NBC News notes that it's not clear how long the former economics professor's administration can last. There are only 84 Socialist deputies in the 350-member legislative assembly.

Sanchez is set to become Spain's seventh prime minister since the country returned to democracy in the late 1970's.