ObjectivesTo assess the association of serum magnesium with prevalent and incident metabolic syndrome (MetS) and its individual components in the general population and to examine any effect modification by chronic kidney disease (CKD) status.MethodsWe analysed longitudinal data from the population‐based KORA F4/FF4 study, including 2996 participants (387 with CKD) for cross‐sectional analysis and 1446 participants (88 with CKD) for longitudinal analysis. Associations with MetS, as well as single components of MetS, were assessed by adjusted regression models. Nonlinearity was tested by restricted cubic splines and analyses were stratified by CKD. Causality was evaluated by two‐sample Mendelian randomization (MR).ResultsSerum magnesium (1 SD) was inversely associated with prevalent MetS (odds ratio [OR] 0.90, 95% confidence interval [CI] 0.83, 0.98). The association was more pronounced in individuals with CKD (OR 0.75, 95% CI 0.59, 0.94). Among MetS components, serum magnesium was negatively associated with elevated fasting glucose (OR 0.78, 95% CI 0.71, 0.88) and, again, this association was more pronounced in individuals with CKD (OR 0.67, 95% CI 0.53, 0.84). Serum magnesium was not associated with incident MetS or its components. Restricted cubic spline analysis revealed a significant nonlinear inverse relationship of serum magnesium with MetS and elevated fasting glucose. MR analysis suggested an inverse causal effect of serum magnesium on MetS (OR 0.91, 95% CI 0.85, 0.97).ConclusionSerum magnesium is associated with prevalent, but not incident MetS, and this effect is stronger in individuals with CKD. MR analysis implies a potential, albeit weak, causal role of magnesium in MetS.