conservatives under Mariano Rajoy to rule as a minority government.
Party leaders decided by a majority at their meeting in Madrid to abstain when Mr Rajoy puts his Popular Party (PP) government to a vote in parliament.
The country had faced the prospect of a third general election inside a year.
But the Socialists forced out their leader, Pedro Sanchez, earlier this month after he rejected abstention.
Mr Rajoy has led a caretaker administration since losing his overall majority in an election last December. A repeat election in June failed to end the impasse but strengthened his hand.
The Socialists (commonly known by their Spanish abbreviation, the PSOE) came second on both occasions, their support eroded by radical leftist newcomers Podemos.
For decades, the PSOE and PP took turns in governing the country on their own but last year the popular vote split four ways - the new centrist Ciudadanos party came fourth.