Many animals attract mating partners through the release of volatile sex pheromones, which can convey information on the species, gender and receptivity of the sender to induce innate courtship and mating behaviours by the receiver. Male Drosophila melanogaster fruitflies display stereotyped reproductive behaviours towards females, and these behaviours are controlled by the neural circuitry expressing male-specific isoforms of the transcription factor Fruitless (FRU(M)). However, the volatile pheromone ligands, receptors and olfactory sensory neurons (OSNs) that promote male courtship have not been identified in this important model organism. Here we describe a novel courtship function of Ionotropic receptor 84a (IR84a), which is a member of the chemosensory ionotropic glutamate receptor family, in a previously uncharacterized population of FRU(M)-positive OSNs. IR84a-expressing neurons are activated not by fly-derived chemicals but by the aromatic odours phenylacetic acid and phenylacetaldehyde, which are widely found in fruit and other plant tissues that serve as food sources and oviposition sites for drosophilid flies. Mutation of Ir84a abolishes both odour-evoked and spontaneous electrophysiological activity in these neurons and markedly reduces male courtship behaviour. Conversely, male courtship is increased--in an IR84a-dependent manner--in the presence of phenylacetic acid but not in the presence of another fruit odour that does not activate IR84a. Interneurons downstream of IR84a-expressing OSNs innervate a pheromone-processing centre in the brain. Whereas IR84a orthologues and phenylacetic-acid-responsive neurons are present in diverse drosophilid species, IR84a is absent from insects that rely on long-range sex pheromones. Our results suggest a model in which IR84a couples food presence to the activation of the fru(M) courtship circuitry in fruitflies. These findings reveal an unusual but effective evolutionary solution to coordinate feeding and oviposition site selection with reproductive behaviours through a specific sensory pathway