Background Postoperative delirium (PD) is a frequent and serious complication of surgery that is associated with a prolonged hospital stay, increased mortality, and decreased quality of life. Identifying the risk factors for PD in elderly patients exposed to anesthetic agents during the perioperative period has the potential to improve patient response to surgery. This prospective cohort study aims to delineate the role of analgesic drugs in the onset of PD in elderly patients undergoing major surgery. Methods A total of 732 patients aged 60 years or more and scheduled for elective major surgery were enrolled in the study. All patients underwent general or combined anesthetic management. The type of analgesia, whether patient-controlled intravenous analgesia or patient-controlled epidural analgesia, depended on the type of surgery and the individual's condition. PD assessment was performed for 7 consecutive days using the Confusion Assessment Method for the Intensive Care Unit. Results Overall, PD occurred in 47 (6.5%) patients from the postoperative day (POD) 1 to POD 5. Multivariate analysis revealed that age (odds ratio [OR]: 1.076; 95% confidence interval [CI]: 1.027-1.128; p = 0.002), cardiac surgery (OR: 2.823; 95% CI: 1.152-6.915; p = 0.023), tramadol administration (OR: 2.060; 95% CI: 1.079-3.933; p = 0.028), and ondansetron administration (OR: 2.158; 95% CI: 1.132-4.111; p = 0.019) were the independent risk factors for PD after major surgery, and the use of sufentanil is a protective factor (OR: 0.317; 95% CI: 0.153-0.656; p = 0.002). The incidence of PD increased with both age and the dose of tramadol. Moreover, gender, preoperative analgesia, preoperative Mini-Mental State Examination score, type of analgesia, anesthetics during surgery, postoperative pain score, rescue analgesics, and medications including fentanyl, flurbiprofen, midazolam, droperidol, and anticholinergics appeared not to associate with PD occurrence. Conclusion Older age, cardiac surgery, and the perioperative use of tramadol and ondansetron are independent risk factors for PD in patients aged >= 60 years, whereas sufentanil serves as a protective factor when used for analgesia. These results indicate that using sufentanil instead of tramadol may help decrease the occurrence of PD in elderly patients following major surgery.