The rise in opioid prescribing in primary care represents a significant international public health challenge, associated with increased psychosocial problems, hospitalisations, and mortality. We evaluated the effects of a comparative feedback intervention with persuasive messaging and action planning on opioid prescribing in primary care. A quasi-experimental controlled interrupted time series analysis used anonymised, aggregated practice data from electronic health records and prescribing data from publicly available sources. The study included 316 intervention and 130 control primary care practices in the Yorkshire and Humber region, UK, serving 2.2 million and 1 million residents, respectively. We observed the number of adult patients prescribed opioid medication by practice between July 2013 and December 2017. We excluded adults with coded cancer or drug dependency. The intervention, the Campaign to Reduce Opioid Prescribing (CROP), entailed bimonthly, comparative, and practice-individualised feedback reports to practices, with persuasive messaging and suggested actions over 1 year. Outcomes comprised the number of adults per 1,000 adults per month prescribed any opioid (main outcome), prescribed strong opioids, prescribed opioids in high-risk groups, prescribed other analgesics, and referred to musculoskeletal services. The number of adults prescribed any opioid rose pre-intervention in both intervention and control practices, by 0.18 (95% CI 0.11, 0.25) and 0.36 (95% CI 0.27, 0.46) per 1,000 adults per month, respectively. During the intervention period, prescribing per 1,000 adults fell in intervention practices (change -0.11; 95% CI -0.30, -0.08) and continued rising in control practices (change 0.54; 95% CI 0.29, 0.78), with a difference of -0.65 per 1,000 patients (95% CI -0.96, -0.34), corresponding to 15,000 fewer patients prescribed opioids. These trends continued post-intervention, although at slower rates. Prescribing of strong opioids, total opioid prescriptions, and prescribing in high-risk patient groups also generally fell. Prescribing of other analgesics fell whilst musculoskeletal referrals did not rise. Effects were attenuated after feedback ceased. Study limitations include being limited to 1 region in the UK, possible coding errors in routine data, being unable to fully account for concurrent interventions, and uncertainties over how general practices actually used the feedback reports and whether reductions in prescribing were always clinically appropriate. Repeated comparative feedback offers a promising and relatively efficient population-level approach to reduce opioid prescribing in primary care, including prescribing of strong opioids and prescribing in high-risk patient groups. Such feedback may also prompt clinicians to reconsider prescribing other medicines associated with chronic pain, without causing a rise in referrals to musculoskeletal clinics. Feedback may need to be sustained for maximum effect.