People with fatty liver disease are at high risk of magnesium deficiency. Meanwhile, low magnesium status is linked to both chronic inflammation and insulin resistance. However, no study has investigated the association between intake of magnesium and risk of mortality due to liver diseases. We evaluated the association between total magnesium intake and mortality due to liver diseases in the Third National Health and Nutrition Examination Study (NHANES III) cohort, which included 13,504 participants who completed liver ultrasound examination for hepatic steatosis. Overall magnesium intake was associated with a reduced risk of mortality due to liver disease at borderline significance (P = 0.05). In fully-adjusted analyses, every 100 mg increase in intake of magnesium was associated with a 49% reduction in the risk for mortality due to liver diseases. Although interactions between magnesium intake and alcohol use and hepatic steatosis at baseline were not significant (P > 0.05), inverse associations between magnesium intake and liver disease mortality were stronger among alcohol drinkers and those with hepatic steatosis. Our findings suggest higher intakes of magnesium may be associated with a reduced risk of mortality due to liver disease particularly among alcohol drinkers and those with hepatic steatosis. Further studies are warranted to confirm the findings.