Manuela Carmena, of the leftist Ahora Madrid coalition, will be inaugurated as mayor of the Spanish capital on Saturday (June 13).
Her party says she has obtained the support of the Socialist Party.
In recent months, the 71-year-old retired judge has become a leading figure in local politics amid huge political and social change taking place throughout the country.
The Ahora-Socialist bloc includes anti-austerity party Podemos and will, effectively, take away control of the capital from the conservative PP Party after 24 uninterrupted years.
Change also seems likely in Barcelona, in the form of Barcelona in Common – an alliance which again includes the left-wing Podemos.
If successful in forming a coalition, group leader Ana Colau will become the first female mayor of one of Spain’s most-visited cities.