Riboswitches are metabolite-binding RNA structures that serve as genetic control elements for certain messenger RNAs. These RNA switches have been identified in all three kingdoms of life and are typically responsible for the control of genes whose protein products are involved in the biosynthesis, transport or utilization of the target metabolite. Herein, we report that a highly conserved RNA domain found in bacteria serves as a riboswitch that responds to the coenzyme S-adenosylmethionine (SAM) with remarkably high affinity and specificity. SAM riboswitches undergo structural reorganization upon introduction of SAM, and these allosteric changes regulate the expression of 26 genes in Bacillus subtilis. This and related findings indicate that direct interaction between small metabolites and allosteric mRNAs is an important and widespread form of genetic regulation in bacteria.