This paper analyzes the role of competition between political parties for the promotion and turnover of social minorities in party organizations. We collect extensive and reliable panel data for the career trajectories of all Swedish politicians in 290 municipal councils over 20 years (N=35,000). We argue that political competition pushes local parties to promote the best individual, which in turn improves gender equality at the top. This finds strong support in the empirical analysis. Heightened competition is associated with smaller gender gaps in re-election, retention on the electoral ballot, and promotions to top positions. An extended analysis shows that variation in the qualifications and family structures of male and female politicians cannot account for these results. As a more plausible mechanism, the analysis suggests that parties have nomination processes that are less centralized and more focused on competence as a selection criteria when competition is fierce.