Tropane alkaloids (TAs) are heterocyclic nitrogenous metabolites found across seven orders of angiosperms, including Malpighiales (Erythroxylaceae) and Solanales (Solanaceae). Despite the well-established euphorigenic properties of Erythroxylaceae TAs like cocaine, their biosynthetic pathway remains incomplete. Using yeast as a screening platform, we identified and characterized the missing steps of TA biosynthesis in
Erythroxylum coca
. We first characterize putative
E. coca
polyamine synthase- and amine oxidase-like enzymes in vitro, in yeast, and in planta to show that the first tropane ring closure in Erythroxylaceae occurs via bifunctional spermidine synthase/
N
-methyltransferases and both flavin- and copper-dependent amine oxidases. We next identify a SABATH family methyltransferase responsible for the 2-carbomethoxy moiety characteristic of Erythroxylaceae TAs and demonstrate that its coexpression with methylecgonone reductase in yeast engineered to express the Solanaceae TA pathway enables the production of a hybrid TA with structural features of both lineages. Finally, we use clustering analysis of
Erythroxylum
transcriptome datasets to discover a cytochrome P450 of the CYP81A family responsible for the second tropane ring closure in Erythroxylaceae, and demonstrate the function of the core coca TA pathway in vivo via reconstruction and de novo biosynthesis of methylecgonine in yeast. Collectively, our results provide strong evidence that TA biosynthesis in Erythroxylaceae and Solanaceae is polyphyletic and that independent recruitment of unique biosynthetic mechanisms and enzyme classes occurred at nearly every step in the evolution of this pathway.