Δ 9 -Tetrahydrocannabinol (THC) and other cannabinoids are responsible for the psychoactive and medicinal properties of Cannabis sativa L. (marijuana). The first intermediate in the cannabinoid biosynthetic pathway is proposed to be olivetolic acid (OA), an alkylresorcinolic acid that forms the polyketide nucleus of the cannabinoids. OA has been postulated to be synthesized by a type III polyketide synthase (PKS) enzyme, but so far type III PKSs from cannabis have been shown to produce catalytic byproducts instead of OA. We analyzed the transcriptome of glandular trichomes from female cannabis flowers, which are the primary site of cannabinoid biosynthesis, and searched for polyketide cyclase-like enzymes that could assist in OA cyclization. Here, we show that a type III PKS (tetraketide synthase) from cannabis trichomes requires the presence of a polyketide cyclase enzyme, olivetolic acid cyclase (OAC), which catalyzes a C2-C7 intramolecular aldol condensation with carboxylate retention to form OA. OAC is a dimeric α+β barrel (DABB) protein that is structurally similar to polyketide cyclases from Streptomyces species. OAC transcript is present at high levels in glandular trichomes, an expression profile that parallels other cannabinoid pathway enzymes. Our identification of OAC both clarifies the cannabinoid pathway and demonstrates unexpected evolutionary parallels between polyketide biosynthesis in plants and bacteria. In addition, the widespread occurrence of DABB proteins in plants suggests that polyketide cyclases may play an overlooked role in generating plant chemical diversity.natural products | phytocannabinoid | terpenophenolic | aldolase | ferredoxin-like