Ask most people to name a nutrient lacking in the American diet, and the top answers would probably be calcium, vitamin D or fiber. Though all nutrients are essential for good health, few are more crucial to focus on than magnesium — because we don’t usually get enough in our diet and none of our cells could function without it.

Cells need the mineral to produce ATP, a compound dubbed the body’s “energy currency,” says Fudi Wang, a professor of nutrition at Zhejiang University in China, because it’s the bank that cells draw on to power their functions. In particular, magnesium is involved in regulating blood pressure, blood sugar, heart rate and nerve transmission.

But nearly half of all Americans — and 70 to 80 percent of those older than 70 — aren’t meeting their daily magnesium needs. Women should be getting 320 milligrams per day; men, 420 mg.

Older people are at risk for magnesium deficiency because they not only tend to consume less of it than younger adults but also may absorb less from what they eat, and their kidneys may excrete more of it. Digestive disorders such as Crohn’s disease and celiac disease can also affect magnesium absorption, and people who have Type 2 diabetes or who take diuretics may lose more through their urine.

Why magnesium matters

These shortfalls may contribute to diminished health long-term. In a 2016 review of 40 studies involving a total of more than 1 million people, Wang and his colleagues found that every 100 mg increase in magnesium from food reduced the risk of heart failure by 22 percent, Type 2 diabetes by 19 percent and stroke by 7 percent.

Those who consumed more magnesium were also less likely to die of any cause during the studies’ follow-up periods, which ranged from four to 30 years.

Getting your daily dose

To get sufficient magnesium, focusing on food is best unless your doctor instructs otherwise, Wang says. High doses from supplements may have unpleasant side effects, such as diarrhea, nausea and abdominal cramps, and may prevent some drugs (such as certain antibiotics and bisphosphonates) from doing their jobs.

Though no one food has a huge amount of the nutrient, it’s not hard to get enough if you keep the best magnesium sources — dark leafy greens, legumes, nuts and whole grains — in regular rotation, says Joan Salge Blake, a clinical associate professor of nutrition at Boston University. For instance, these foods supply at least 50 mg per serving: ½ cup cooked quinoa, 2 tablespoons pumpkin seeds, ¼ cup almonds, ¾ cup cooked chickpeas, 2 heaping cups raw spinach, and 1 ounce 70 to 85 percent dark chocolate.

Supplements may be appropriate, however, if you have a digestive disorder or diabetes. Long-term use of proton pump inhibitors (PPIs) for acid reflux may also lead to a magnesium deficiency.

Magnesium supplements may help migraine sufferers, but if you get nighttime leg cramps, they’re probably not the answer. Supplements have long been used as a remedy, but research suggests that pills won’t do much to prevent these muscle spasms.

Copyright 2017. Consumers Union of United States Inc.

For further guidance, go to www.ConsumerReports.org/Health, where more detailed information, including CR’s ratings of prescription drugs, treatments, hospitals and healthy-living products, is available to subscribers.