KEY MESSAGE: A combined transcriptomic and metabolic analysis of Setaria viridis leaves responding to aphid infestation was used to identify genes related to serotonin biosynthesis. Setaria viridis (green foxtail), a short life-cycle C4 plant in the Poaceae family, is the wild ancestor of Setaria italica (foxtail millet), a resilient crop that provides good yields in dry and marginal land. Although S. viridis has been studied extensively in the last decade, the molecular mechanisms of insect resistance in this species remain under-investigated. To address this issue, we performed a metabolic analysis of S. viridis and discovered that these plants accumulate the tryptophan-derived compounds tryptamine and serotonin. To elucidate the defensive functions of serotonin, Rhophalosiphum padi (bird cherry-oat aphids) were exposed to this compound, either by exogenous application to the plant medium or with artificial diet bioassays. In both cases, exposure to serotonin increased aphid mortality. To identify genes that are involved in serotonin biosynthesis, we conducted a transcriptome analysis and identified several predicted S. viridis tryptophan decarboxylase (TDC) and tryptamine 5-hydroxylase (T5H) genes. Two candidate genes were ectopically expressed in Nicotiana tabacum, where SvTDC1 (Sevir.6G066200) had tryptophan decarboxylase activity, and SvT5H1 (Sevir.8G219600) had tryptamine hydroxylase activity. Moreover, the function of the SvTDC1 gene was validated using virus-induced gene silencing in S. italica, which caused a reduction in serotonin levels. This study provides the first evidence of serotonin biosynthesis in Setaria leaves. The biosynthesis of serotonin may play an important role in defense responses and could prove to be useful for developing more pest-tolerant Setaria italica cultivars.