The aim of the study was to investigate the cross-sectional association between diabetes and dental caries in a representative sample of 23,089 adults residing in Spain. Data from the Spanish National Health Survey 2017 were analysed. Diabetes (independent variable) and dental caries (dependent variable) were evaluated through a self-reported questionnaire. The association between diabetes and dental caries in the overall sample was assessed using logistic regression models adjusted for sex, age, marital status, education, smoking, alcohol consumption, obesity, hypertension, and hypercholesterolemia. The prevalence of dental caries was 20.6% in the overall population and was significantly higher in men and in young (≤40 years) and middle-aged adults (41–65 years) than in women and older adults (>65 years), respectively. After adjusting for control variables, there was a positive and significant association between diabetes and dental caries in the overall population (OR = 1.30, 95% CI = 1.15–1.46). The relationship between diabetes and dental caries was particularly strong in women (OR = 1.45, 95% CI = 1.22–1.71) and in adults aged ≤40 years (OR = 1.80, 95% CI = 1.05–3.05). In conclusion, in this large representative sample of Spanish adults, diabetes was associated with having a higher prevalence of dental caries, with females and younger adults at greatest risk. Patients with diabetes and dental practitioners should be aware of these associations and act accordingly. Future research should aim to investigate the mediating factors involved in the observed association between diabetes and dental caries.