Early menopause—before age 45—is associated with a slew of health problems. Until now, there wasn’t much a woman could do to prevent it—at least not easily.

But there may be a kind of food that can help protect you from starting down the menopause path too soon.

It’s probably already in your refrigerator.

Background: Women who go through early menopause (before age 45) are more likely to suffer osteoporosis, cardiovascular disease and cognitive decline than women who continue to produce estrogen for more years. Unfortunately, the known factors that affect the time of menopause aren’t easily modified—they include a woman’s age when she had her first period, how many children she’s had and, if she breastfed, for how long.

But some studies have suggested that vitamin D may play a role. So investigators decided to plumb a major database of women and diet to learn more.

Study: Researchers used data from the Nurses’ Health Study II, which began collecting information from 116,000 female nurses who were between the ages of 25 and 42 in 1989. Information about medical conditions and lifestyle behaviors was collected every other year, and dietary questionnaires were completed every four years. In this study, only the 86,234 women who had not started menopause before completing their first food questionnaires were included.

The researchers divided the women into five groups based on their cumulative average intake of vitamin D and calcium over 20 years. They broke down results by dairy foods onlyall dietary sources…and all dietary sources-plus-supplements.

Results: After adjusting for age, body mass index, smoking and other factors, women with the highest dietary intake of vitamin D had 17% reduced risk for early menopause compared with women with the lowest dietary intake. Similarly, dietary calcium was associated a 13% reduction in risk. And, both associations were stronger for dairy sources of vitamin D and calcium than for nondairy dietary sources.

Surprising finding: While taking vitamin D supplements was not associated with early menopause risk at all, taking calcium supplements was linked to a slightly higher risk for early menopause. However, the researchers note, this result may just reflect women who were taking calcium supplements due to other health concerns—such as a family history of osteoporosis. It’s possible that these other issues may be behind the early menopause in these cases.

Bottom line: Foods rich in calcium and vitamin D—especially dairy foods—might help women stave off going into menopause too early. It’s an observational study, so it doesn’t prove cause and effect. But it’s one more reason—potentially a big reason for some women—to choose whole foods rich in calcium and vitamin D, which we already know are healthful for a bunch of other reasons. Besides dairy sources, you can find vitamin D in eggs and fish, and calcium in leafy greens, almonds and canned salmon and sardines (eaten with the bones).