Transgenerational effects on health and development of early-life nutrition have gained increased attention recently. However, the underlying mechanisms of transgenerational transmission are only starting to emerge, with epigenetics as perhaps the most important mechanism. We recently reported the first animal model to study transgenerational programming of longevity after early-life dietary manipulations, enabling investigations to identify underlying epigenetic mechanisms. We report here that post-eclosion dietary manipulation (PDM) with a low-protein (LP) diet upregulates the protein level of E(z), an H3K27 specific methyltransferase, leading to higher levels of H3K27 trimethylation (H3K27me3). This PDM-mediated change in H3K27me3 corresponded with a shortened longevity of F0 flies as well as their F2 offspring. Specific RNAi-mediated post-eclosion knockdown of E(z) or pharmacological inhibition of its enzymatic function with EPZ-6438 in the F0 parents improved longevity while rendering H3K27me3 low across generations. Importantly, addition of EPZ-6438 to the LP diet fully alleviated the longevity-reducing effect of the LP PDM, supporting the increased level of E(z)-dependent H3K27me3 as the primary cause and immediate early-life period as the critical time to program longevity through epigenetic regulation. These observations establish E(z)-mediated H3K27me3 as one epigenetic mechanism underlying nutritional programming of longevity and support the use of EPZ-6438 to extend lifespan.