Foods with magnesium include leafy greens like spinach, nuts and seeds such as almonds and cashews, beans and legumes like black beans, soy in various forms, such as edamame, fatty fish (for example, salmon), whole grains, and certain brands of mineral water.