Increasing age is tightly linked to decreased thickness of the human neocortex. The biological mechanisms that mediate this effect are hitherto unknown. The DNA methylome, as part of the epigenome, contributes significantly to age-related phenotypic changes. Here, we identify an epigenetic signature that is associated with cortical thickness (P=3.86 × 10-8) and memory performance in 533 healthy young adults. The epigenetic effect on cortical thickness was replicated in a sample comprising 596 participants with major depressive disorder and healthy controls. The epigenetic signature mediates partially the effect of age on cortical thickness (P<0.001). A multilocus genetic score reflecting genetic variability of this signature is associated with memory performance (P=0.0003) in 3,346 young and elderly healthy adults. The genomic location of the contributing methylation sites points to the involvement of specific immune system genes. The decomposition of blood methylome-wide patterns bears considerable potential for the study of brain-related traits.