Researchers examined the effects of 446 different chemical compounds on the immune system and identified two which had a significant impact.
The two compounds appeared to work with vitamin D to increase the activity of a gene known as CAMP which helps boost the body's ability to fight disease. One of the compounds, resveratrol, which is found in red grapes, is thought to have various healthy effects on the body such as fighting cancer and lowering the risk of heart disease. But the new study, by researchers from Oregon State University, was the first to clearly show the way in which the compound works with vitamin D to produce this effect.
The other compound which stood out in the study was pterostilbene, found in blueberries, which previous studies have linked to lower cholesterol and better heart health.
Dr Adrian Gombart, who led the study, said: "Out of a study of hundreds of compounds, just these two popped right out. Their synergy with vitamin D to increase CAMP gene expression was significant and intriguing."