The two-component system PhoP/PhoQ controls a large number of genes responsible for a variety of physiological and virulence functions in Salmonella enterica serovar Typhimurium. Here we describe a mechanism whereby the transcriptional activator PhoP elicits expression of dissimilar gene sets when its cognate sensor PhoQ is activated by different signals in the periplasm. We determine that full transcription of over half of the genes directly activated by PhoP requires the Mg2+ transporter MgtA when the PhoQ inducing signal is low Mg2+, but not when PhoQ is activated by mildly acidic pH or the antimicrobial peptide C18G. MgtA promotes the active (i.e. phosphorylated) form of PhoP by removing Mg2+ from the periplasm, where it functions as a repressing signal for PhoQ. MgtA-dependent expression enhances resistance to the cationic antibiotic polymyxin B. Production of the MgtA protein requires cytoplasmic Mg2+ levels to drop below a certain threshold, thereby creating a two-tiered temporal response among PhoP-dependent genes.