Medium-length methylketones (C7-C15) are highly effective in protecting plants from numerous pests. We used a biochemical genomics approach to elucidate the pathway leading to synthesis of methylketones in the glandular trichomes of the wild tomato Lycopersicon hirsutum f glabratum (accession PI126449). A comparison of gland EST databases from accession PI126449 and a second L. hirsutum accession, LA1777, whose glands do not contain methylketones, showed that the expression of genes for fatty acid biosynthesis is elevated in PI126449 glands, suggesting de novo biosynthesis of methylketones. A cDNA abundant in the PI126449 gland EST database but rare in the LA1777 database was similar in sequence to plant esterases. This cDNA, designated Methylketone Synthase 1 (MKS1), was expressed in Escherichia coli and the purified protein used to catalyze in vitro reactions in which C12, C14, and C16 β-ketoacyl–acyl-carrier-proteins (intermediates in fatty acid biosynthesis) were hydrolyzed and decarboxylated to give C11, C13, and C15 methylketones, respectively. Although MKS1 does not contain a classical transit peptide, in vitro import assays showed that it was targeted to the stroma of plastids, where fatty acid biosynthesis occurs. Levels of MKS1 transcript, protein, and enzymatic activity were correlated with levels of methylketones and gland density in a variety of tomato accessions and in different plant organs.