Women are generally under-represented in top positions in the labor market, and it is largely documented that the gender gap in professional careers widens as the seniority of the position increases. In this paper we study one potential explanation for the “leaky pipeline”, namely gender differences in success at forming coalitions in male-dominated environments. We use data from municipal elections in Spain, where municipal councils choose the mayor among list-leaders by majority rule, after a general election to select the council members. We study gender-mixed close elections between 1999 and 2015 and show that female leaders that gain the plurality of votes in the general election are significantly less likely to form a government coalition than male leaders with the same electoral support. The gender difference is not accounted for by differences in leaders’ party affiliation or political experience, and it is larger the higher the share of men involved in the bargaining. Our findings might be relevant in contexts where a group elects its head (e.g. government assemblies or corporate boards). More generally, since group support and alliances are arguably crucial to lead a hierarchical organization, our findings indicate that lower success in securing group support and alliances is a potential contributor to women’s scarcity in top positions.