Dietary restriction (DR) is known to promote autophagy to exert its longevity effect. While SAMS-1 (S-adenosyl methionine synthetase-1) has been shown to be a key mediator of the DR response, little is known about the roles of S-adenosyl methionine (SAM) and SAM-dependent methyltransferase in autophagy and DR-induced longevity. In this study, we show that DR and SAMS-1 repress the activity of SET-2, a histone H3K4 methyltransferase, by limiting the availability of SAM. Consequently, the reduced H3K4me3 levels promote the expression and activity of two transcription factors, HLH-30/TFEB and PHA-4/FOXA, which both regulate the transcription of autophagy-related genes. We then find that HLH-30/TFEB and PHA-4/FOXA act collaboratively on their common target genes to mediate the transcriptional response of autophagy-related genes and consequently the lifespan of the animals. Our study thus shows that the SAMS-1-SET-2 axis serves as a nutrient-sensing module to epigenetically coordinate the activation of HLH-30/TFEB and PHA-4/FOXA transcription factors to control macroautophagy/autophagy and longevity in response to DR.