Epigenetic DNA modifications in genes related to the hypothalamic–pituitary–adrenal (HPA) axis are discussed as a mechanism underlying the association between prenatal depression and altered child HPA activity. In a longitudinal study, DNA methylation changes related to prenatal depressive symptoms were investigated in 167 children aged 6 to 9 years. At six candidate genes, 126 cytosine–guanine dinucleotides were considered without correcting for multiple testing due to the exploratory nature of the study. Further associations with the basal child HPA activity were examined. Children exposed to prenatal depressive symptoms exhibited lower bedtime cortisol (p = .003, ηp2 = 0.07) and a steeper diurnal slope (p = .023, ηp2 = 0.06). For total cortisol release, prenatal exposure was related to lower cortisol release in boys, and higher release in girls. Furthermore, prenatal depressive symptoms were associated with altered methylation in the glucocorticoid receptor gene (NR3C1), the mineralocorticoid receptor gene (NR3C2), and the serotonin receptor gene (SLC6A4), with some sex-specific effects (p = .012–.040, ηp2 = 0.03–0.04). In boys, prenatal depressive symptoms predicted bedtime cortisol mediated by NR3C2 methylation, indirect effect = –0.07, 95% confidence interval [–0.16, –0.02]. Results indicate relations of prenatal depressive symptoms to both child basal HPA activity and DNA methylation, partially fitting a mediation model, with exposed boys and girls being affected differently.