Magnesium (Mg) deficiency is a common nutritional disorder that is linked to an inflammatory state characterized by increased plasma acute phase protein and proinflammatory cytokine concentrations. Recent studies have shown that changes in the composition of gut microbiota composition participate in systemic inflammation. In this study, therefore, we assessed the potential role of gut microbiota in intestinal and systemic inflammation associated with Mg deficiency in mice. For this purpose, mice were fed a control or Mg-deficient diet (500 mg vs. 70 mg Mg/kg) for 4 or 21 d. Compared with the mice fed the control diet, mice fed the Mg-deficient diet for 4 d had a lower gut bifidobacteria content (-1.5 log), a 36-50% lower mRNA content of factors controlling gut barrier function in the ileum (zonula occludens-1, occludin, proglucagon), and a higher mRNA content (by approximately 2-fold) in the liver and/or intestine of tumor necrosis factor-alpha, interleukin-6, CCAAT/enhancer binding protein homologous protein, and activating transcription factor 4, reflecting inflammatory and cellular stress. In contrast, mice fed the Mg-deficient diet for 21 d had a higher cecal bifidobacteria content compared with the control group, a phenomenon accompanied by restoration of the intestinal barrier and the absence of inflammation. In conclusion, we show that Mg deficiency, independently of any other changes in nutrient intake, modulates the concentration of bifidobacteria in the gut, a phenomenon that may time-dependently affect inflammation and metabolic disorders in mice.