In infected cells, Epstein-Barr virus (EBV) alternates between latency and lytic replication. The viral bZIP transcription factor ZEBRA (Zta, BZLF1) regulates this cycle by binding to two classes of ZEBRA response elements (ZREs): CpG-free motifs resembling the consensus AP-1 site recognized by cellular bZIP proteins and CpG-containing motifs that are selectively bound by ZEBRA upon cytosine methylation. We report structural and mutational analysis of ZEBRA bound to a CpG-methylated ZRE (meZRE) from a viral lytic promoter. ZEBRA recognizes the CpG methylation marks through a ZEBRA-specific serine and a methylcytosine-arginine-guanine triad resembling that found in canonical methyl-CpG binding proteins. ZEBRA preferentially binds the meZRE over the AP-1 site but mutating the ZEBRA-specific serine to alanine inverts this selectivity and abrogates viral replication. Our findings elucidate a DNA methylation-dependent switch in ZEBRA's transactivation function that enables ZEBRA to bind AP-1 sites and promote viral latency early during infection and subsequently, under appropriate conditions, to trigger EBV lytic replication by binding meZREs.