Sex roles are typically thought of as being fixed for a given species. In most animals males compete for females, whereas the females are more reluctant to mate. Therefore sexual selection usually acts most strongly on males1,2. This is explained by males having a higher potential reproductive rate than females, leading to more males being sexually active (a male-biased operational sex ratio)3,4. However, what determines sex roles and the strength of sexual selection is a controversial and much debated question3,5-10. In this large-scale field study, we show a striking temporal plasticity in the mating competition of a fish (two-spotted goby,Gobiusculus flavescens). Over the short breeding season fierce male-male competition and intensive courtship behaviour in males were replaced by female-female competition and actively courting females. Hence, sex role reversal occurred rapidly. This is the first time that a shift in sex roles has been shown in a vertebrate. The shift might be explained by a large decline in male abundance, strongly skewing the sex ratio towards females. Notably, the sex role reversal did not occur at an equal operational sex ratio, contrary to established sex role theory3,4.