Objective Although the major cause of morbidity and mortality in patients with diabetes mellitus (DM) is cardiovascular disease, DM is also associated with certain site-specific cancers. However, whether DM is associated with an increased risk of cancer of the digestive tract remains undetermined. A nationwide, population-based database in Taiwan was analyzed to explore the relationship between DM and cancer of the digestive organs. Methods From 2000 to 2007, a study cohort consisting of 39,515 patients with newly diagnosed diabetes without a previous diagnosis of gastrointestinal (GI) cancer was identified from the National Health Insurance Research Database in Taiwan. A control cohort of 79,030 age-and sex-matched non-diabetic subjects was selected to compare the occurrence of GI malignancies between the two groups. The association between the incidence of GI cancers and the use of glucose-lowering therapies was also investigated. Results During the 7-year follow-up period, GI cancers developed in 929 diabetic patients (2.35%) and 1,126 subjects (1.42%) in the comparison cohort. DM was associated with a 2.75-fold (95% confidence interval (CI), 2.51-3.02) higher risk of developing GI malignancy. Among GI cancers, the incidences of stomach (adjusted hazard ratio (HR), 1.49; 95% CI, 1.16-1.92), liver (adjusted HR, 2.65; 95% CI, 2.29-3.07), colon (adjusted HR, 1.58; 95% CI, 1.28-1.94) and pancreatic cancers (adjusted HR, 4.35; 95% CI, 2.93-6.47) were significantly increased in the patients with DM. An analysis of the effects of various glucose-lowering therapies in the diabetic patients revealed the use of α-glucosidase inhibitors to be associated with a lower risk of hepatic cancer (adjusted HR, 0.62; 95% CI, 0.4-0.94). Thiazolidinedione (TZD) treatment was associated with lower stomach (adjusted HR, 0.11; 95% CI, 0.02-0.82) and hepatic cancer risks (adjusted HR, 0.46; 95% CI, 0.29-0.73), while sulfonylurea use was associated with a lower colon cancer risk (adjusted HR, 0.74; 95% CI, 0.51-1.09) and a higher pancreatic cancer risk (adjusted HR, 2.36; 95% CI, 1.21-4.61). Conclusion Patients with DM have an increased risk of GI malignancy that may be affected by the use of different categories of glucose-lowering therapies.