Spanish lawmakers on Friday voted to oust Prime Minister Mariano Rajoy, paving the way for the leader of the center-left Socialists, Pedro Sanchez, to take his job.

The no-confidence vote came as Rajoy's conservative People's Party (PP) is mired in a funding scandal that last week saw 29 people linked to the party, including elected officials, receive heavy sentences while the party itself was fined for operating hidden accounts.

Watch video 00:36 Rajoy arrives at parliament for no-confidence vote

The vote

The motion was passed with 180 votes in favor, 169 against and 1 abstention

The vote was carried by Sanchez' own PSOE party, which filed the motion and has 84 seats in the parliament, with the help of the leftist alliance Unidos Podemos, which holds 67 seats, and of several regional parties.

'An honor'

Ahead of the vote, Rajoy, 63, told the parliament that it had "been an honor to leave Spain better than I found it. Thank you to all Spaniards and good luck."

He already conceded defeat and congratulated Sanchez, 46, as the next prime minister.

Sanchez said after the vote that he would address the "social urgencies of many people who suffer precariousness and inequality" in Spain after years of austerity under Rajoy's government.

A spokeswoman for European Commission President Jean-Claude Juncker said he had "full confidence" in the new Spanish government. She said he had sent Sanchez a congratulatory letter to that effect.

Read more: Who is Pedro Sanchez, Spain's prime minister-designate?

Success at a cost: Although Rajoy is largely considered to have helped bring Spain out of its recession crisis since he took power in 2011, critics say that the austerity measures he imposed exacerbated inequalities and that he failed to curb the country's high unemployment. His party has also faced continued allegations of corruption over the past years, culminating in the recent scandal.

Historic vote: Rajoy's defeat marks the first time a Spanish premier has lost a no-confidence vote since the transition to democracy in Spain after the death of dictator Francisco Franco in 1975.

What is Rajoy's party accused of? The National Court in Madrid last week handed down prison sentences to the tune of a combined 351 years to 29 people in connection with a slush fund set up in the 1990s and early 2000s to illegally finance PP campaigns. The party was fined €245,000 ($287,000) for benefiting from the kickbacks-for-contracts scheme. Judges did not find that current government members had committed any wrongdoing.

What happens next? Sanchez is expected to take office by Monday and his Cabinet to be appointed by next week. However, the support of nationalist and leftist parties in Friday's vote does not necessarily mean they will back Sanchez' government, which could lead to a political stalemate in parliament. The center-right Ciudadanos (Citizens) party has already announced its opposition to the incoming minority Socialist government and has urged Sanchez to call an early general election.

tj/rt (AFP, dpa)