Peanut (Arachis hypogaea) and its wild relatives are among the few species that naturally synthesize resveratrol, a well-known stilbenoid phytoalexin that plays a crucial role in plant defense against biotic and abiotic stresses. Resveratrol has received considerable attention due to its health benefits, such as preventing and treating various human diseases and disorders. Chalcone (CHS) and Stilbene (STS) Synthases are plant-specific type III Polyketide Synthases (PKSs) that share the same substrates and are key branch enzymes in the biosynthesis of flavonoids and stilbenoids, respectively. Although resveratrol accumulation in response to external stimulus has been described in peanut, there are no comprehensive studies of the CHS and STS gene families in the genus Arachis. In the present study, we identified and characterized 6 CHS and 46 STS genes in the tetraploid peanut and an average of 4 CHS and 22 STS genes in three diploid wild species (Arachis duranensis, Arachis ipaënsis and Arachis stenosperma). The CHS and STS gene and protein structures, chromosomal distributions, phylogenetic relationships, conserved amino acid domains, and cis-acting elements in the promoter regions were described for all Arachis species studied. Based on gene expression patterns of wild A. stenosperma STS genes in response to different biotic and abiotic stresses, we selected the candidate AsSTS4 gene, which is strongly induced by ultraviolet (UV) light exposure, for further functional investigation. The AsSTS4 overexpression in peanut hairy roots significantly reduced (47%) root-knot nematode infection, confirming that stilbene synthesis activation in transgenic plants can increase resistance to pathogens. These findings contribute to understanding the role of resveratrol in stress responses in Arachis species and provide the basis for genetic engineering for improved production of valuable secondary metabolites in plants.