Objective: Patients with cancer are at high risk of depression. However, the risk of major depressive disorder (MDD) after cancer diagnosis has not been studied in a population setting in Japan. This cohort study used a Japanese medical claims database to examine time to MDD in cancer patients and the risk of MDD (hazard ratio; HR) compared with matched cancer-free controls. Methods: Primary endpoint was time to MDD (starting 6 months before cancer diagnosis) in adult (18-74 years) cancer patients; secondary endpoint was time to MDD (6 months before to 12 months after cancer diagnosis) in a matched cohort of cancer patients and cancer-free controls. Multivariate analyses were performed to determine HRs for all cancers and for each cancer site. Results: Of 35 008 cancer patients (mean age, 53.3 years), 2201 (6.3%) were diagnosed with MDD within 66 months. Matched cancer patients (n = 30 372) had an elevated risk of MDD compared with cancer-free controls (n = 303 720; HR [95% confidence interval] 2.96 [2.77-3.16]). MDD risk was highest in patients with multiple cancers, pancreatic cancer, and brain cancer. Compared with middle-aged patients, risk was higher in patients <40 years old and lower in patients ≥65 years old; risk tended to be higher in women than in men. Conclusions: Compared with cancer-free individuals, Japanese patients with cancer, mostly <65 years old, had an almost threefold higher risk of developing MDD within 12 months of cancer diagnosis. Physicians should watch for MDD in cancer patients and treat when necessary.