Socialist Josele González is the new mayor of Mijas after an eleventh-hour deal between the local PSOE and Ciudadanos groups.
In Friday's vote González beat his PP counterpart Ángel Nozal with his eight councillors plus the support of the six representatives of Cs, headed locally by until now acting mayor, Juan Carlos Maldonado.
Talks between the Socialists and Cs appear to have gone on right up to the start of the tense council meeting on Friday morning, as uncertainty reigned until the very last minute.
The Partido Popular councillors had indicated earlier this week that they would vote for their own leader, Ángel Nozal, rather than abiding by the power-sharing coalition pact with Ciudadanos reached by their party chiefs on a regional and national level.
The agremeent between the PSOE and Cs has prevented Nozal becoming mayor by default as the PP had one more seat than the PSOE.