The use of opioids is associated with poor outcomes. Less is known about this association in patients with heart failure (HF) and whether it varies by the receipt of hospice care. Of the 7467 patients hospitalized for HF without previous opioid use, 124 received discharge opioids. We matched 123 of these patients with 123 not receiving opioids based on their propensity scores for opioid use, thus assembling a matched cohort of 246 patients balanced on 30 baseline characteristics (mean age, 76 years, 60% women, and 11% African American). We repeated the process in hospice (n = 155; 20 received opioids) and nonhospice (n = 7298; 104 received opioids) subgroups, thus assembling 2 matched cohorts of 22 and 208 patients, respectively. Hazard ratios (HRs) and 95% confidence intervals (CIs) associated with opioid use were estimated from matched cohorts. During 8.6 (median, 1.4) years of follow-up, all-cause mortality occurred in 80% and 68% of matched patients in the opioid and nonopioid groups, respectively (HR, 1.49; 95% CI, 1.11-1.99; P = 0.008). There was evidence of heterogeneity in this association between hospice and nonhospice patients (P for interaction, 0.027). Among matched hospice and nonhospice patients, HRs (95% CIs) for mortality were 6.37 (2.06-19.69; P = 0.001) and 1.42 (1.03-1.96; P = 0.035), respectively. HRs (95% CIs) for 30-day and 1-year mortality were 1.98 (1.06-3.70; P = 0.033) and 1.72 (1.18-2.49; P = 0.004), respectively. HRs (95% CIs) for all-cause, HF, and non-HF readmissions were 1.31 (0.97-1.76; P = 0.079), 1.03 (0.71-1.49; P = 0.866), and 1.75 (1.05-2.91; P = 0.031), respectively. Readmission associations were similar among matched nonhospice patients. There was no readmission among matched hospice patients receiving opioids. In older patients with HF, opioid use is associated with a higher risk of mortality, which is greater in the hospice subgroup, and a higher risk of non-HF readmission in the nonhospice subgroup.