Individual neurons express only one or a few of the many identified neurotransmitters and neuropeptides, but the molecular mechanisms controlling their selection are poorly understood. In the Drosophila ventral nerve cord, the six Tv neurons express the neuropeptide gene FMRFamide. Each Tv neuron resides within a neuronal cell group specified by the LIM-homeodomain gene apterous. We find that the zinc-finger gene squeeze acts in Tv cells to promote their unique axon pathfinding to a peripheral target. There, the BMP ligand Glass bottom boat activates the Wishful thinking receptor, initiating a retrograde BMP signal in the Tv neuron. This signal acts together with apterous and squeeze to activate FMRFamide expression. Reconstituting this "code," by combined BMP activation and apterous/squeeze misexpression, triggers ectopic FMRFamide expression in peptidergic neurons. Thus, an intrinsic transcription factor code integrates with an extrinsic retrograde signal to select a specific neuropeptide identity within peptidergic cells.