Getting the right amount of vitamins and minerals can lower your risk of an early death, but they should come from food instead of supplements, a study published Tuesday suggests.

Researchers from Tufts University say they found no association between the use of dietary supplements and a lower risk of death.

The study analyzed data from a larger health and nutrition survey conducted from 1999 to 2010. More than 30,000 participants ages 20 and older answered questions about dietary supplement use.

Results showed people who got adequate amounts of vitamin K and magnesium lowered their risk of early death, and those who got enough vitamin A, vitamin K and zinc had a lower risk of death from cardiovascular disease. Those benefits were earned only when those nutrients came from food, not supplements.

"While supplement use contributes to an increased level of total nutrient intake, there are beneficial associations with nutrients from foods that aren't seen with supplements," said Fang Fang Zhang, an author on the study and associate professor at the Friedman School of Nutrition Science and Policy at Tufts University, in a statement.

The research was published in the peer-reviewed journal Annals of Internal Medicine.

The study found excess intake of calcium through supplements was associated with a higher risk of death from cancer. Researchers say there was no link between cancer risk and calcium intake from food.

Several studies have called into question the need for supplements and whether they actually improve overall health.

Last year, a study published in the peer-reviewed Journal of the American College of Cardiology found vitamin and mineral supplements offered no measurable health benefits to prevent cardiovascular disease.

A study in 2017 warned that men taking too much vitamin B could double their risk of developing lung cancer.

Contributing: Ashley May. Follow Brett Molina on Twitter: @brettmolina23.