Transposable elements are common in genomes and must be controlled. Many organisms use DNA methylation to silence such selfish DNA, but the mechanisms that restrict the methylation to appropriate regions are largely unknown. We identified a JmjC domain protein in Neurospora, DNA METHYLATION MODULATOR-1 (DMM-1), that prevents aberrant spreading of DNA and histone H3K9 methylation from inactivated transposons into nearby genes. Mutation of a conserved residue within the JmjC Fe(II)-binding site abolished dmm-1 function, as did mutations in conserved cysteine-rich domains. Mutants defective only in dmm-1 mutants grow poorly, but growth is restored by reduction or elimination of DNA methylation using the drug 5-azacytosine or by mutation of the DNA methyltransferase gene dim-2. DMM-1 relies on an associated protein, DMM-2, which bears a DNA-binding motif, for localization and proper function. HP1 is required to recruit the DMM complex to the edges of methylated regions.