Frequency-dependent selection is a fundamental principle of adaptive sex ratio evolution in all sex ratio theories but has rarely been detected in the wild. Through long-term censuses, we confirmed large fluctuations in the population sex ratio of the aphid Prociphilus oriens and detected frequency-dependent selection acting on these fluctuations. Fluctuations in the population sex ratio were partly attributable to climatic factors during the growing season. Climatic factors likely affected the growth conditions of host plants, which in turn led to yearly fluctuations in maternal conditions and sex ratios. In the process of frequency-dependent selection, female proportion higher or lower than ca. 60% was associated with a reduction or increase in female proportion, respectively, the next year. The rearing of aphid clones in the laboratory indicated that mothers of each clone produced an increasing number of females as maternal size increased. However, the mean male number was not related to maternal size, but varied largely among clones. Given genetic variance in the ability to produce males among clones, selection should favour clones that can produce more numerous males in years with a high female proportion. Population-level sex allocation to females was on average 71%-73% for three localities and more female-biased when maternal conditions were better. This tendency was accounted for by the hypothesis of competition among foundresses rather than the hypothesis of local mate competition. We conclude that despite consistent operation of frequency-dependent selection, the sex ratio continues to fluctuate because environmental conditions always push it away from equilibrium.