Mating and egg laying are tightly cooordinated events in the reproductive life of all oviparous females. Oviposition is typically rare in virgin females but is initiated after copulation. Here we identify the neural circuitry that links egg laying to mating status in Drosophila melanogaster. Activation of female-specific oviposition descending neurons (oviDNs) is necessary and sufficient for egg laying, and is equally potent in virgin and mated females. After mating, sex peptide—a protein from the male seminal fluid—triggers many behavioural and physiological changes in the female, including the onset of egg laying1. Sex peptide is detected by sensory neurons in the uterus2,3,4, and silences these neurons and their postsynaptic ascending neurons in the abdominal ganglion5. We show that these abdominal ganglion neurons directly activate the female-specific pC1 neurons. GABAergic (γ-aminobutyric-acid-releasing) oviposition inhibitory neurons (oviINs) mediate feed-forward inhibition from pC1 neurons to both oviDNs and their major excitatory input, the oviposition excitatory neurons (oviENs). By attenuating the abdominal ganglion inputs to pC1 neurons and oviINs, sex peptide disinhibits oviDNs to enable egg laying after mating. This circuitry thus coordinates the two key events in female reproduction: mating and egg laying.