Transcriptional gene silencing (TGS) serves as an antiviral defence in plants but is inhibited by the geminivirus protein TrAP via an unknown mechanism. Castillo-Gonzáles et al. now show that TrAP targets the H3K9me2 histone methyltransferase KRYPTONITE (KYP) in Arabidopsis thaliana to subvert host immunity. TrAP inhibited the methyltransferase activity of KYP in vitro and reduced levels of the H3K9me2 mark in vivo. Notably, KYP was observed to bind to and methylate viral chromatin, and geminivirus that lacked the TrAP protein could only establish systemic infection in a kyp mutant.