Background In various disease contexts, magnesium abnormalities are associated with acute kidney injury (AKI) incidence. However, this association remains unclear and has not been systematically investigated in patients with cirrhosis. Hence, we aimed to elucidate the association between admission serum magnesium levels and AKI incidence in intensive care unit (ICU)-admitted cirrhotic patients. Methods A retrospective cohort study was conducted using MIMIC-IV2.2 data, focusing on critically ill patients with cirrhosis. We employed univariable and multivariable logistic regression and restricted cubic spline analyses to robustly address our research objectives. To further substantiate the findings, subgroup and sensitivity analyses were also conducted. Results Among the 3,228 enrolled ICU-admitted cirrhotic patients, 34.4% were female, and the overall AKI incidence was 68.6% (2,213/3,228). Multivariable logistic regression analysis revealed an independent relationship between elevated serum magnesium levels and increased AKI risk (OR = 1.55 [95% CI = 1.15–2.09], p = 0.004). Compared with individuals with serum magnesium levels < 1.6 mg/dL, individuals with serum magnesium levels in Q2 (1.6–2.6 mg/dL) and Q3 (≥2.6 mg/dL) had adjusted ORs for AKI of 1.89 (95% CI = 1.34–2.65, p < 0.001) and 2.19 (95% CI = 1.27–3.75, p = 0.005), respectively. The restricted cubic spline analysis revealed that AKI risk increased linearly with increasing serum magnesium levels. Subgroup analysis revealed that the association between serum magnesium levels and AKI incidence was remarkably stable in subgroup analysis (all P interaction >0.05). Conclusions High serum magnesium concentrations were significantly associated with an increased AKI risk in ICU-admitted patients with cirrhosis. Further randomized trials are needed to confirm this association.