Spanish Prime Minister Mariano Rajoy is set to be forced out of office in a motion of no confidence.

On Friday he congratulated Socialist Party leader Pedro Sánchez, who will become prime minister after the ballot.

Mr Sánchez, who needs 176 votes, filed the no-confidence motion after Mr Rajoy's People's Party (PP) was implicated in a corruption scandal.

Mr Rajoy will be the first prime minister in modern Spanish history to be defeated in such a motion.

On Friday, as debate on the no-confidence motion resumed for a second day, he told parliament that it has been "an honour to leave a better Spain than I found".

He said me hoped Mr Sánchez would be able to "say the same".

The opposition Socialists have secured support for the non-confidence motion from various smaller parties, including the Basque Nationalist Party - which has a crucial five seats in parliament.

Why was the vote called?
Mr Sánchez says Mr Rajoy, 63, had failed to take responsibility for his party's involvement in the scandal, which returned under scrutiny last week after one of its former treasurers was given a 33-year jail sentence.

The High Court in Madrid convicted Luis Bárcenas of receiving bribes, money laundering and tax crimes.

The case centred on a secret campaign fund the PP ran from 1999 until 2005.

Many Spanish voters, exasperated by corruption scandals involving the traditional centre-right PP and centre-left Socialist parties, have abandoned them for newcomers like the left-wing Podemos (We Can) and centrist Ciudadanos (Citizens), as well as regional parties.