Key PointsQuestionWhat is the association between intraoperative opioid administration and postoperative pain and opioid use?FindingsIn this cohort study of 61 249 individuals undergoing surgery, greater intraoperative fentanyl and hydromorphone administration was associated with decreased pain and opioid administration in postanesthesia care units. In particular, greater fentanyl administration was associated with decreased new chronic pain diagnoses at 3 months, decreased opioid prescriptions at 30, 90, and 180 days, and decreased new persistent opioid use, without significant increases in adverse effects.MeaningThe results indicate that intraoperative opioid administration was associated with short- and long-term postoperative pain and opioid outcomes; reduced opioid administration during surgery may have the unintended outcome of increasing postoperative pain and opioid use.