Persistent opioid use (POU) is common after surgery and is associated with an increased risk of mortality and morbidity. There have been no population-based studies exploring POU in opioid-naïve surgical patients in New Zealand (NZ). This study aimed to determine the incidence and risk factors for POU in opioid-naïve patients undergoing surgery in all NZ hospitals. We included all opioid-naïve patients who underwent surgery without a concomitant trauma diagnosis and received opioids after discharge from any NZ hospital between January 2007 and December 2019. Patients were considered opioid naïve if no opioids had been dispensed to them or if they did not have a prior diagnosis of an opioid-use disorder up to 365 days preceding the index date. The primary outcome was the incidence of POU, defined a priori as opioid use after discharge between 91 and 365 days. We used a multivariable logistic regression to identify risk factors for POU. We identified 1789,407 patients undergoing surgery with no concomitant diagnosis of trauma; 377,144 (21.1%) were dispensed opioids and 260,726 patients were eligible and included in the analysis. Of those included in the final sample, 23,656 (9.1%; 95% confidence interval [CI], 9.0%-9.2%) developed POU. Risk factors related to how opioids were prescribed included: changing to different opioid(s) after discharge (adjusted odds ratio [aOR], 3.21; 95% CI, 3.04-3.38), receiving multiple opioids on discharge (aOR, 1.37; 95% CI, 1.29-1.45), and higher total oral morphine equivalents (>400 mg) (aOR, 1.23; 95% CI, 1.23-1.45). Conversely, patients who were coprescribed nonopioid analgesics on discharge had lower odds of POU (aOR, 0.91; 95% CI, 0.87-0.95). Only small differences were observed between different ethnicities. Other risk factors associated with increased risk of POU included undergoing neurosurgery (aOR, 2.02; 95% CI, 1.83-2.24), higher comorbidity burden (aOR, 1.90; 95% CI, 1.75-2.07), preoperative nonopioid analgesic use (aOR, 1.65; 95% CI, 1.60-1.71), smoking (aOR, 1.44; 95% CI, 1.35-1.54), and preoperative hypnotics use (aOR, 1.35; 95% CI, 1.28-1.42). Approximately 1 in 11 opioid-naïve patients who were dispensed opioids on surgical discharge, developed POU. Potentially modifiable risk factors for POU, related to how opioids were prescribed included changing opioids after discharge, receiving multiple opioids, and higher total dose of opioids given on discharge. Clinicians should discuss the possibility of developing POU with patients before and after surgery and consider potentially modifiable risk factors for POU when prescribing analgesia on discharge after surgery.