Having the breakfast brew could lower the risk of a stroke by eight per cent and heart failure by seven per cent, with increased reductions dependent on how much you have.
Researchers used a machine to analyse data from the long-running Framlingham Heart study.
The machine-led analysis by the University of Colorado was then compared with two other studies done on more traditional lines to get the overall trend.
The machine result also pointed to red meat being a risk factor in heart failure and stroke, but due to differing definitions of red meat, they could not draw the same conclusion across all three studies.
First author of the study and doctoral student Laura Stevens said: “Machine learning works by finding associations within data, much in the same way that online shopping sites predict products you may like based on your shopping history, and is one type of big data analysis.
“We used traditional analysis in two studies with similar sets of data – the Cardiovascular Heart Study and the Atherosclerosis Risk In Communities Study.
“The association between drinking coffee and a decreased risk of heart failure and stroke was consistently noted in all three studies.
“Drinking coffee was associated with decreased risk of developing heart failure by seven per cent and stroke by eight per cent with every additional cup of coffee consumed per week compared with non-coffee drinkers.
“It is important to note that this type of study design demonstrates an observed association, but does not prove cause and effect.”
She added: “Our findings suggest that machine learning could help us identify additional factors to improve existing risk assessment models.
“The risk assessment tools we currently use for predicting whether someone might develop heart disease, particularly heart failure or stroke, are very good but they are not 100 per cent accurate.”
The research was presented at the American Heart Association’s Scientific Sessions 2017, in California.
Senior author Professor David Kao added: “By including coffee in the model, the prediction accuracy increased by four percent.
“Machine learning may a useful addition to the way we look at data and help us find new ways to lower the risk of heart failure and strokes.”