A shift from the traditional perspective that maternal stress is invariably costly has instigated recent interest into its adaptive role in offspring sex allocation. Stress generated by social instability has been linked to offspring sex ratio biases that favour the production of female offspring, which converges with the theoretical prediction that mothers in the poor condition are better off investing in daughters rather than sons. However, previous research has failed to disentangle two different processes: the passive consequence of maternal stress on sex-specific mortality and the adaptive effect of maternal stress at the time of conception. Here, I show that exposure to high male density social conditions leads to elevated stress hormone levels and female-biased in utero offspring sex ratios in house mice (Mus musculus domesticus), and identify that sex-specific offspring production-not sex-specific mortality-is the mechanism accounting for these sex ratio skews. This outcome reflects the optimal fitness scenario for mothers in a male-dominated environment: the production of daughters, who are guaranteed high mate availability, minimizes male-male competition for their sons. Overall, this study supports the idea that maternal stress has the potential to be adaptive and advances our understanding of how exposure to different social conditions can influence sex allocation in mammals.