Trace elements, such as iodine and selenium, are closely related to autoimmune thyroiditis and thyroid function. Low serum magnesium is associated with several chronic diseases; however, its associations with autoimmune thyroiditis and thyroid function are unclear. We investigated the relationships between low serum magnesium, autoimmune thyroiditis, and thyroid function in 1,257 Chinese participants. Demographic data were collected via questionnaires, and levels of serum thyroid stimulating hormone, anti-thyroid peroxidase antibody, anti-thyroglobulin antibody (TGAb), free thyroxine, serum magnesium, serum iodine, and urinary iodine concentration were measured. Participants were divided into serum magnesium level quartiles (≤0.55, 0.551-0.85, 0.851-1.15, and >1.15 mmol/L). The median serum magnesium level was 0.89 (0.73-1.06) mmol/L; levels ≤0.55 mmol/L were considered severely low (5.9% of participants). The risks of TGAb positivity and Hashimoto thyroiditis (HT) diagnosed using ultrasonography in the lowest quartile group were higher than those in the adequate magnesium group (0.851-1.15 mmol/L) (p < 0.01, odds ratios [ORs] = 2.748-3.236). The risks of total and subclinical-only hypothyroidism in the lowest quartile group were higher than those in the adequate magnesium group (0.851-1.15 mmol/L) (p < 0.01, ORs = 4.482-4.971). Severely low serum magnesium levels are associated with an increased rate of TGAb positivity, HT, and hypothyroidism.