BackgroundIndividuals with diabetes have increased risk of depression, but there are limited nationally representative studies on this topic. We aimed to investigate the prevalence and predictors of depression, as well as its impact on all-cause and cardiovascular mortality in adults with type 2 diabetes (T2DM) using a prospective cohort study and a representative sample of the U.S. population.MethodsWe analyzed National Health and Nutrition Examination Survey (NHANES) data from 2005 to 2018 and linked it with the most recent publicly available National Death Index (NDI) data. Individuals aged 20 years or old who had depression measurements were included. Depression was defined as a Patient Health Questionnaire (PHQ-9) score ≥ 10, and categorized into moderate (10–14 points) and moderately severe to severe (≥ 15 points). Cox proportional hazard models were used to estimate the association between depression and mortality.ResultsAmong 5695 participants with T2DM, 11.6% had depression. Depression was associated with female gender, younger age, overweight, lower education, being unmarried, smoking, and a history of coronary heart disease and stroke. During a mean follow-up period of 78.2 months, 1161 all-cause deaths occurred. Total depression and moderately severe to severe depression significantly increased all-cause mortality (adjusted hazard ratio [aHR] 1.36, 95% CI [1.09–1.70]; 1.67 [1.19–2.34]) and non-cardiovascular mortality (aHR 1.36, 95% CI [1.04–1.78]; 1.78, 95% CI [1.20–2.64]), but not cardiovascular mortality. Subgroup analysis showed a significant association between total depression and all-cause mortality in males (aHR 1.46, 95% CI [1.08–1.98]) and those aged 60 years or older (aHR 1.35, 95% CI [1.02–1.78]). Any severity of depression was not significantly associated with cardiovascular mortality in age- or gender- stratified subgroups.ConclusionsIn a nationally representative sample of U.S. adults with T2DM, approximately 10% experienced depression. Depression did not significantly associate with cardiovascular mortality. However, comorbid depression in T2DM patients increased the risk of all-cause and non-cardiovascular mortality. The impact of depression on mortality varied across subgroups. Therefore, healthcare providers should consider incorporating depression screening and management into routine care, especially for subgroups with specific risk factors, due to the increased risk of all-cause mortality in T2DM patients with depression.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12888-023-04999-z.