Vitamin B6 is an essential metabolic cofactor that has more functions in humans than any other single nutrient. Its de novo biosynthesis occurs through two mutually exclusive pathways that are absent in animals. The predominant pathway found in most prokaryotes, fungi, and plants has only recently been discovered. It is distinguished by a glutamine amidotransferase, which is remarkable in that it alone can synthesize the cofactor form, pyridoxal 5'-phosphate (PLP), directly from a triose and a pentose saccharide and glutamine. Here we report the 3D structure of the PLP synthase complex with substrate glutamine bound as well as those of the individual synthase and glutaminase subunits Pdx1 and Pdx2, respectively. The complex is made up of 24 protein units assembled like a cogwheel, a dodecameric Pdx1 to which 12 Pdx2 subunits attach. In contrast to the architecture of previously determined glutamine amidotransferases, macromolecular assembly is directed by an N-terminal alpha-helix on the synthase. Interaction with the synthase subunit leads to glutaminase activation, resulting in formation of an oxyanion hole, a prerequisite for catalysis. Mutagenesis permitted identification of the remote glutaminase and synthase catalytic centers and led us to propose a mechanism whereby ammonia shuttles between these active sites through a methionine-rich hydrophobic tunnel.