DNA methylation is involved in epigenetic processes such as X-chromosome inactivation, imprinting and silencing of transposons. We have demonstrated previously that dim-2 encodes a DNA methyltransferase that is responsible for all known cytosine methylation in Neurospora crassa. Here we report that another Neurospora gene, dim-5, is required for DNA methylation, as well as for normal growth and full fertility. We mapped dim-5 and identified it by transformation with a candidate gene. The mutant has a nonsense mutation in a SET domain of a gene related to histone methyltransferases that are involved in heterochromatin formation in other organisms. Transformation of a wild-type strain with a segment of dim-5 reactivated a silenced hph gene, apparently by 'quelling' of dim-5. We demonstrate that recombinant DIM-5 protein specifically methylates histone H3 and that replacement of lysine 9 in histone H3 with either a leucine or an arginine phenocopies the dim-5 mutation. We conclude that DNA methylation depends on histone methylation.