The phytohormone cytokinin regulates plant growth and development. This hormone is also synthesized by some phytopathogenic bacteria, such as Agrobacterium tumefaciens, and is as a key factor in the formation of plant tumors. The rate-limiting step of cytokinin biosynthesis is catalyzed by adenosine phosphate-isopentenyltransferase (IPT). Agrobacterium IPT has a unique substrate specificity that enables it to increase trans-zeatin production by recruiting a metabolic intermediate of the host plant's biosynthetic pathway. Here, we show the crystal structures of Tzs, an IPT from A. tumefaciens, complexed with AMP and a prenyl-donor analogue, dimethylallyl S-thiodiphosphate. The structures reveal that the carbon-nitrogen-based prenylation proceeds by the SN2-reaction mechanism. Site-directed mutagenesis was used to determine the amino acid residues, Asp-173 and His-214, which are responsible for differences in prenyl-donor substrate specificity between plant and bacterial IPTs. IPT and the p loop-containing nucleoside triphosphate hydrolases likely evolved from a common ancestral protein. Despite structural similarities, IPT has evolved a distinct role in which the p loop transfers a prenyl moiety in cytokinin biosynthesis.