The PhoP-PhoQ two-component system is commonly used by bacteria to sense environmental factors. Here we show that the PhoP-PhoQ system of Edwardsiella tarda detects changes in environmental temperature and Mg2+ concentration as well as regulates the type III and VI secretion systems through direct activation of esrB. Protein secretion is activated from 23 to 35°C or at low Mg2+ concentrations, but it is suppressed at or below 20°C, at or above 37°C, or at high Mg2+ concentrations. The effects of temperature and Mg2+ concentration are additive. The PhoQ sensor domain has a low Tm of 37.9°C, and it detects temperatures through a conformational change of its secondary structure. Mutation of specific Pro or Thr residues increased the stability of the PhoQ sensor drastically, altering its temperature-sensing ability. The PhoQ sensor detects Mg2+ concentration through the direct binding of Mg2+ to a cluster of acidic residues (DDDSAD) and through changes that likely affect its tertiary structure. Here, we describe for the first time the use of PhoP-PhoQ as a temperature sensor for bacterial virulence control.