Chronic hepatitis C virus (HCV) infection is a leading cause of liver cancer. The association of HCV infection with extrahepatic cancers, and the impact of direct-acting antiviral (DAA) treatment on these cancers, is less well known. We conducted a cohort study in a healthcare delivery system. Using electronic health record data from 2007 to 2017, we determined cancer incidence, overall and by type, in people with HCV infection and by DAA treatment status. All analyses included comparisons with a reference population of people without HCV infection. Covariate-adjusted Poisson models were used to estimate incidence rate ratios. 2,451 people with HCV and 173,548 people without HCV were diagnosed with at least one type of cancer. Compared with people without HCV, those with HCV were at higher risk for liver cancer [adjusted incidence rate ratio (aIRR) = 31.4, 95% confidence interval (CI) = 28.9-34.0], hematologic cancer (aIRR = 1.3, 95% CI = 1.1-1.5), lung cancer (aIRR = 1.3, 95% CI = 1.2-1.5), pancreatic cancer (aIRR = 2.0, 95% CI = 1.6-2.5), oral/oropharynx cancer (aIRR = 1.4, 95% CI = 1.1-1.8), and anal cancer (aIRR = 1.6, 95% CI = 1.1-2.4). Compared with people without HCV, the aIRR for liver cancer was 31.9 (95% CI = 27.9-36.4) among DAA-untreated and 21.2 (95% CI = 16.8-26.6) among DAA-treated, and the aIRR for hematologic cancer was 1.5 (95% CI = 1.1-2.0) among DAA-untreated and 0.6 (95% CI = 0.3-1.2) among DAA-treated. People with HCV infection were at increased risk of liver cancer, hematologic cancer, and some other extrahepatic cancers. DAA treatment was associated with reduced risk of liver cancers and hematologic cancers. DAA treatment is important for reducing cancer incidence among people with HCV infection.