AimsThe aim of this study was to evaluate the association between vitamin D deficiency and risk of heart failure in elderly patients of cardiology outpatient clinics.Methods and resultsA cross‐sectional study with an analytical approach was employed. Clinical data were collected from the elderly from August 2015 to February 2016. The dependent variable was the risk of heart failure; the independent variable was vitamin D deficiency; and intervening factors were age, gender, education, ethnicity, hypertension, diabetes mellitus, hypothyroidism, renal failure, dementia, stroke, dyslipidaemia, depression, smoking, alcoholism, obesity, andropause, and cardiac arrhythmia. To analyse the association between vitamin D deficiency and risk of heart failure, we used the bivariate logistic analysis, followed by analysis through the multivariate logistic regression model. Of the 137 elderly, the study found the following: women (75.9%); overweight (48.2%); obese (30.6%); increase in the index waist/hip (88.3%); dyslipidaemia (94.2%) and hypertension (91.2%); coronary artery disease (35.0%); and 27.7% with cardiac arrhythmia or left ventricular hypertrophy. Sixty‐five per cent of the elderly were deficient in vitamin D. The risk of heart failure was significantly associated with vitamin D deficiency [odds ratio (OR): 12.19; 95% confidence interval (CI) = 4.23–35.16; P = 0.000], male gender (OR: 15.32; 95% CI = 3.39–69.20, P = 0.000), obesity (OR: 4.17; 95% CI = 1.36–12.81; P = 0.012), and cardiac arrhythmia (OR: 3.69; 95% CI = 1.23–11.11; P = 0.020).ConclusionsThere was a high prevalence of vitamin D deficiency in the elderly, and the evidence shows a strong association between vitamin D deficiency and increased risk of heart failure in this population.