Specific modifications to histones are essential epigenetic markers---heritable changes in gene expression that do not affect the DNA sequence. Methylation of lysine 9 in histone H3 is recognized by heterochromatin protein 1 (HP1), which directs the binding of other proteins to control chromatin structure and gene expression. Here we show that HP1 uses an induced-fit mechanism for recognition of this modification, as revealed by the structure of its chromodomain bound to a histone H3 peptide dimethylated at Nzeta of lysine 9. The binding pocket for the N-methyl groups is provided by three aromatic side chains, Tyr21, Trp42 and Phe45, which reside in two regions that become ordered on binding of the peptide. The side chain of Lys9 is almost fully extended and surrounded by residues that are conserved in many other chromodomains. The QTAR peptide sequence preceding Lys9 makes most of the additional interactions with the chromodomain, with HP1 residues Val23, Leu40, Trp42, Leu58 and Cys60 appearing to be a major determinant of specificity by binding the key buried Ala7. These findings predict which other chromodomains will bind methylated proteins and suggest a motif that they recognize.