Ions are not traditionally thought to act as first messengers in signal transduction cascades. However, while searching for genes regulated by the PhoP/PhoQ virulence regulatory system of Salmonella typhimurium, we recovered two loci whose expression is controlled by the concentration of Mg2+. To determine whether Mg2+ is the signal modulating the whole PhoP/PhoQ system, we evaluated the gene expression pattern of six PhoP-activated genes. Growth in physiological concentrations of divalent cations repressed transcription of PhoP-activated genes and rendered wild-type Salmonella phenotypically PhoP-. Mg2+ changed the conformation of the periplasmic domain of PhoQ, identifying this protein as a Mg2+ sensor. A mutation in the sensing domain of PhoQ altered the set point for Mg2+ and rendered Salmonella avirulent.