Gastric cancer is a leading cause of cancer-related deaths in China. Affecting more than 40% of the world's population, Helicobacter pylori is a major risk factor for gastric cancer. While previous clinical trials indicated that eradication of H. pylori could reduce gastric cancer risk, this remains to be shown using a population-based approach. We conducted a community-based, cluster-randomized, controlled, superiority intervention trial in Linqu County, China, with individuals who tested positive for H. pylori using a 13C-urea breath test randomly assigned to receiving either (1) a 10-day, quadruple anti-H. pylori treatment (comprising 20 mg of omeprazole, 750 mg of tetracycline, 400 mg of metronidazole and 300 mg of bismuth citrate) or (2) symptom alleviation treatment with a single daily dosage of omeprazole and bismuth citrate. H. pylori-negative individuals did not receive any treatment. We examined the incidence of gastric cancer as the primary outcome. A total of 180,284 eligible participants from 980 villages were enrolled over 11.8 years of follow-up, and a total of 1,035 cases of incident gastric cancer were documented. Individuals receiving anti-H. pylori therapy showed a modest reduction in gastric cancer incidence in intention-to-treat analyses (hazard ratio 0.86, 95% confidence interval 0.74-0.99), with a stronger effect observed for those having successful H. pylori eradication (hazard ratio 0.81, 95% confidence interval 0.69-0.96) than for those who failed treatment. Moderate adverse effects were reported in 1,345 participants during the 10-day treatment. We observed no severe intolerable adverse events during either treatment or follow-up. The findings suggest the potential for H. pylori mass screening and eradication as a public health policy for gastric cancer prevention. Chinese Clinical Trial Registry identifier: ChiCTR-TRC-10000979 .