Background: This study investigated the influence of human cytochrome P450 2D6 (CYP2D6) gene polymorphism in gastric cancer (GC) patients to understand the pharmacogenomic basis for patient response to postoperative fentanyl analgesia. Methods: The prospective study design contained 212 patients recovering from radical gastrectomy. Peripheral blood samples were collected after general anesthesia, and CYP2D6 genotypes were analyzed using polymerase chain reaction-restriction fragment length polymorphism (PCR-RFLP) method. After providing adequate instructions to operate the analgesia pump, patients self-administered fentanyl via patient controlled intravenous analgesia. The cumulative amount of fentanyl self-administered and the associated adverse effects were recorded at 6, 12, 24, and 48 h postoperatively. Results: Five patients, out of the 212 patients recruited to this study, failed to complete the study. The remaining 207 patients were classified into three groups based on their genotypes: W/W group (n=44), M/W group (n=112), and M/M group (n=51). Our results demonstrated that the cumulative amount of fentanyl consumption significantly increased in the M/M group at 6, 12, and 24 h postoperatively, compared with the W/W group (p<0.05). In addition, visual analogue scale (VAS) score in the M/M group was significantly higher than the W/W group in the analepsia period after general anesthesia and at 6 h postoperatively (p<0.05). No significant adverse effects were observed in all the groups (p>0.05). Conclusion: CYP2D6 polymorphism influenced patient response to postoperative fentanyl analgesia in GC patients.