Despite suggestions that higher serum magnesium (Mg) levels are associated with improved outcome, the association with mortality in European hemodialysis (HD) patients has only scarcely been investigated. Furthermore, data on the association between serum Mg and sudden death in this patient group is limited. Therefore, we evaluated Mg in a post-hoc analysis using pooled data from the CONvective TRAnsport STudy (CONTRAST, NCT00205556), a randomized controlled trial (RCT) evaluating the survival risk in dialysis patients on hemodiafiltration (HDF) compared to HD with a mean follow-up of 3.1 years. Serum Mg was measured at baseline and 6, 12, 24 and 36 months thereafter. Cox proportional hazards models, adjusted for confounders using inverse probability weighting, were used to estimate hazard ratios (HRs) of baseline serum Mg on all-cause mortality, cardiovascular mortality, non-cardiovascular mortality and sudden death. A generalized linear mixed model was used to investigate Mg levels over time. Out of 714 randomized patients, a representative subset of 365 (51%) were analyzed in the present study. For every increase in baseline serum Mg of 0.1 mmol/L, the HR for all-cause mortality was 0.85 (95% CI 0.77-94), the HR for cardiovascular mortality 0.73 (95% CI 0.62-0.85) and for sudden death 0.76 (95% CI 0.62-0.93). These findings did not alter after extensive correction for potential confounders, including treatment modality. Importantly, no interaction was found between serum phosphate and serum Mg. Baseline serum Mg was not related to non-cardiovascular mortality. Mg decreased slightly but statistically significant over time ([DELTA] -0.011 mmol/L/year, 95% CI -0.017 to -0.009, p = 0.03). In short, serum Mg has a strong, independent association with all-cause mortality, cardiovascular mortality and sudden death in European HD patients. Serum Mg levels decrease slightly over time.