Labour will form a minority administration at Fife Council, despite not being the largest party after the council election earlier this month.
Councillors backed the party's amendment by 41 votes to 34.
It means the SNP's motion has been defeated and therefore they will go into opposition, despite being four seats short of a majority.
The Liberal Democrats and Conservatives supported Labour's amendment.
David Ross has also been voted in as the local authority's leader by 41 votes to 33.
Meanwhile, Jim Leishman has been appointed as Provost of Fife for a third successive time after defeating John Beare by 40 votes to 33 to take the role.
The Dunfermline Athletic legend was previously appointed in 2012 and 2017.