The perception that the inheritance of phenotypic traits operates solely through genetic means is slowly being eroded: epigenetic mechanisms have been shown to induce heritable changes in gene activity in plants1,2 and metazoans1,3. Inheritance of DNA methylation patterns provides a potential pathway for environmentally induced phenotypes to contribute to evolution of species and populations1,2,3,4,5. However, in basal metazoans, it is unknown whether inheritance of CpG methylation patterns occurs across the genome (as in plants) or as rare exceptions (as in mammals)4. Here, we show that DNA methylation patterns in a reef-building coral are determined by genotype and developmental stage, as well as by parental environment. Transmission of CpG methylation from adults to their sperm and larvae demonstrates genome-wide inheritance. Variation in the hypermethylation of genes in adults and their sperm from distinct environments suggests intergenerational acclimatization to local temperature and salinity. Furthermore, genotype-independent adjustments of methylation levels in stress-related genes were strongly correlated with offspring survival rates under heat stress. These findings support a role of DNA methylation in the intergenerational inheritance of traits in corals, which could extend to enhancing their capacity to adapt to climate change.