Want to live longer? Try sipping on some wine and nibbling on chocolate.

A new study published in the Journal of Internal Medicine found that people who followed an anti-inflammatory diet of fruits, vegetables, tea, coffee and, yes, even a moderate amount of wine and chocolate were 18 percent less likely to die prematurely.

Researchers from The Warsaw University of Life Sciences in Poland followed the eating habits of 68,000 Swedish men and women for 16 years. They found that participants who stuck to the diet were 13 percent less likely to die from cancer by 13 percent and 20 percent less likely to die from cardiovascular problems. Even smokers who ate anti-inflammatory foods saw greater health benefits than smokers who didn’t.

“Even partial adherence to the anti-inflammatory diet may provide a health benefit,” Joanna Kaluza, a professor at the Karolinska Institute in Solna, Sweden, wrote in the study.

Inflammation can be the cause of diseases like cancers, dementia and cardiovascular disease, according to the Mayo Clinic.

A separate study in August found that consuming three bars of chocolate every month could cut your risk for heart failure by 13 percent.

But with alcohol, moderation is key. The Mayo Clinic recommends drinking about five fluid ounces of wine, which is equivalent to one glass, if you want to reap its heart benefits.