When compared with avoiding coffee, it was also associated with a lower risk of cardiovascular disease, the study found.
The findings applied to ground, instant and decaffeinated varieties of the drink, and researchers say they suggest coffee consumption should be considered part of a healthy lifestyle.
According to the study, the greatest risk reduction was seen with two to three cups per day.
Compared with no coffee drinking, this was associated with a 14%, 27% and 11% lower likelihood of death for decaffeinated, ground and instant preparations, respectively.
Study author Professor Peter Kistler of the Baker Heart and Diabetes Research Institute, Australia, said: “In this large, observational study ground, instant and decaffeinated coffee were associated with equivalent reductions in the incidence of cardiovascular disease and death from cardiovascular disease or any cause.
“The results suggest that mild to moderate intake of ground, instant and decaffeinated coffee should be considered part of a healthy lifestyle.”
The study examined the links between types of coffee and heart rhythms, cardiovascular disease and death using data from the UK Biobank study, which recruited adults between 40 and 69 years of age.
Cardiovascular disease was made up of coronary heart disease, congestive heart failure and ischaemic stroke.
Prof Kistler said: “Caffeine is the most well-known constituent in coffee, but the beverage contains more than 100 biologically active components.
“It is likely that the non-caffeinated compounds were responsible for the positive relationships observed between coffee drinking, cardiovascular disease and survival.
“Our findings indicate that drinking modest amounts of coffee of all types should not be discouraged but can be enjoyed as a heart healthy behaviour.”
The study included 449,563 people who completed a questionnaire asking how many cups of coffee they drank each day and whether they usually drank instant, ground or decaffeinated coffee.
They were then split into six daily intake categories, consisting of none, less than one, one, two to three, four to five, and more than five cups per day.
The usual coffee type was instant in 198,062 (44.1%), ground in 82,575 (18.4%) and decaffeinated in 68,416 (15.2%).
There were 100,510 (22.4%) non-coffee drinkers included in the study.
Coffee drinkers were compared with non-drinkers for the incidence of arrhythmias (irregular heart beat), cardiovascular disease and death.
Researchers found that 27,809 (6.2%) people died during a follow-up period of 12.5 years.
The study found that all types of coffee were linked with a reduction in death from any cause.
The research suggests that cardiovascular disease was diagnosed in 43,173 (9.6%) people during the follow-up.
While all coffee types were associated with a reduction in cardiovascular disease, the lowest risk was observed with two to three cups a day.
Compared with abstinence from coffee, it was associated with a 6%, 20% and 9% reduced likelihood of cardiovascular disease for decaffeinated, ground and instant coffee respectively.
Drinking more coffee did not lower the cardiovascular risk – in fact those people drinking four or more cups per day were less likely to enjoy benefits than those drinking two to three cups a day.
The study also found that arrhythmia was diagnosed in 30,100 (6.7%) people.
For this condition, ground and instant coffee, but not decaffeinated, was associated with a reduction in arrhythmias including atrial fibrillation – a condition that causes an irregular and often fast heartbeat.
Compared with non-coffee drinkers, the lowest risks were observed with four to five cups a day for ground coffee and two to three cups a day for instant coffee, with 17% and 12% reduced risks respectively.
The findings are published in the European Journal of Preventive Cardiology.