Caffeine is a major component of xanthine alkaloids and commonly consumed in many popular beverages. Due to its occasional side effects, reduction of caffeine in a natural way is of great importance and economic significance. Recent studies reveal that caffeine can be converted into non-stimulatory theacrine in the rare tea plant Camellia assamica var. kucha (Kucha), which involves oxidation at the C8 and methylation at the N9 positions of caffeine. However, the underlying molecular mechanism remains unclear. Here, we identify the theacrine synthase CkTcS from Kucha, which possesses novel N9-methyltransferase activity using 1,3,7-trimethyluric acid but not caffeine as a substrate, confirming that C8 oxidation takes place prior to N9-methylation. The crystal structure of the CkTcS complex reveals the key residues that are required for the N9-methylation, providing insights into how caffeine N-methyltransferases in tea plants have evolved to catalyze regioselective N-methylation through fine tuning of their active sites. These results may guide the future development of decaffeinated drinks.