Deazapurine-containing secondary metabolites comprise a broad range of structurally diverse nucleoside analogues found throughout biology, including various antibiotics produced by species of Streptomyces bacteria and the hypermodified tRNA bases queuosine and archaeosine. Despite early interest in deazapurines as antibiotic, antiviral, and antineoplastic agents, the biosynthetic route toward deazapurine production has remained largely elusive for more than 40 years. Here we present the first in vitro preparation of the deazapurine base preQ(0), by the successive action of four enzymes. The pathway includes the conversion of the recently identified biosynthetic intermediate, 6-carboxy-5,6,7,8-tetrahydropterin, to a novel intermediate, 7-carboxy-7-deazaguanine (CDG), by an unusual transformation catalyzed by Bacillus subtilis QueE, a member of the radical SAM enzyme superfamily. The carboxylate moiety on CDG is converted subsequently to a nitrile to yield preQ(0) by either B. subtilis QueC or Streptomyces rimosus ToyM in an ATP-dependent reaction, in which ammonia serves as the nitrogen source. The results presented here are consistent with early radiotracer studies on deazapurine biosynthesis and provide a unified pathway for the production of deazapurines in nature.