The present study aimed to investigate the prevalence of thrombocytopenia and its association with serum magnesium in a nationally representative cohort. A total of 8478 participants aged 18 years and over were recruited in a cross-sectional survey. Thrombocytopenia was defined as platelet count less than 150 × 10(9)/L. Multivariable logistic regression models were applied to examine the association between serum magnesium and thrombocytopenia. The prevalence of thrombocytopenia in total was 16.5% with 18.8% for men and 14.4% for women (P < 0.0001), respectively. Compared with men in the first quartile of serum magnesium, the odds ratios (ORs) and 95% confidence intervals (CIs) for those in the second, third, and fourth quartiles of serum magnesium were 0.96 (0.75, 1.21), 0.78 (0.62, 0.98), and 0.82 (0.65, 1.04), respectively, after adjusting for multiple confounders. Likewise, the corresponding ORs (95% CIs) were 0.80 (0.63, 1.01), 0.79 (0.62, 0.99), and 0.65 (0.51, 0.84) in women. When serum magnesium was treated as a continuous variable, each one standard deviation increase of magnesium was associated with 12 and 8% lower risk of thrombocytopenia in men and women, respectively. Serum magnesium was inversely associated with thrombocytopenia, and the association was slightly different in men compared with that in women.