Males of Drosophila melanogaster exhibit stereotypic courtship behavior through which they assess potential mates by processing multimodal sensory information. Although previous studies revealed important neural circuits involved in this process, the full picture of circuits that participate in male courtship remains elusive. Here, we established a genetic tool to visualize or optogenetically reactivate neural circuits activated upon specific behavior, exploiting promoter activity of a neural activity-induced gene Hr38 With this approach, we visualized neural circuits activated in the male brain and the ventral nerve cord when a male interacted with a female. The labeling of neural circuits was additively dependent on inputs from antennae and foreleg tarsi. In addition, neural circuits that express the sex-determining gene fruitless or doublesex were extensively labeled by interaction with a female. Furthermore, optogenetic reactivation of the labeled neural circuits induced courtship posture. With this mapping system, we found that a fruitless-positive neural cluster aSP2 was labeled when a male interacted with a female, in addition to previously characterized neurons. Silencing of neurons including aSP2 led to frequent interruption of courtship and significant reduction of mating success rate without affecting latency to start courtship, suggesting that these neurons are required for courtship persistency important for successful copulation. Overall, these results demonstrate that activity-dependent labeling can be used as a powerful tool not only in vertebrates, but also in invertebrates, to identify neural circuits regulating innate behavior.