Previous studies uncovered a negative relationship between the proportion of women in public office and corruption. These findings have inspired anti-corruption programs around the world. It remains unclear, however, whether there is a causal link between the share of women in office and malfeasance. For instance, gender differences in political experience or access to corruption networks can explain this relationship. We leverage the gradual implementation of gender quotas in Spain to isolate the effects of female descriptive representation on public misconduct and adjudicate between alternative explanations. The analyses suggest a causal link between gender and malfeasance in office: the reform generated an exogenous increase in the share of women elected, which led to a decrease in corruption that was sustained over time. This finding enhances our understanding of the effect of public officials' characteristics on policy outcomes, and of the role of parity laws in promoting political change.