Objective Based on the study on the effect of the nalbuphine pretreatment combined with ultrasound-guided paraspinal nerve block on the cellular immune function of the patients with lung cancer undergoing thoracoscopic surgery, to evaluate the optimization effect of the nalbuphine pretreatment combined with ultrasound-guided percutaneous nerve block. Methods Sixty patients with lung cancer undergoing thoracoscopic surgery. Age 40-70 year. Weight 55-80 kg. America society of Anesthesiologists score standard (ASA) class Ⅰ or Ⅱ. TNM stage stage Ⅰ or Ⅱ. Use a random number table method. The patients were randomly divided into 3 groups (n=20): Control group (group A), nalbuphine pretreatment group (group B), nalbuphine pretreatment + Ropivacaine group (group C). After entering the operating room group C after the local anesthesia was blocked anesthesia guided by ultrasound-guided in the surgical side of T4, T7 and T9 at the root of the transverse process. Inject 0.5% ropivacaine 10 ml per point. The anesthesia induction was initiated after the block plane was determined. Before the induction of general anesthesia, the group B and group C were injected nalbuphine 20 mg intravenously. as the same way, group A was injected equal volume physiological saline. The anesthesia was maintained by two-channel target using remifentanil and propofol.5 min before anesthesia induction (T0), 1 h after surgery (T1), when the surgery finished (T2), and 24 hours after the surgery finished (T3). Take the central vein blood sample. To detect the concentration of the norepinephrine (NE), epinephrine (E) and cortisol (Cor) and the T lymphocyte subgroup CD3+ , CD4+ , CD8+ level and CD4+ /CD8+ ratio in the T0-T3 plasma. Record the dosage of propofol, remifentanil and the utilization rate of vasoactive drug in the convalescent period. Results Compared with T0, the cell level of CD3+ : 50.6±6.0, CD4+ : 28.4±6.2 and the ratio of CD4+ /CD8+ : 1.3±0.1 were decreased in group A at T2, and the cell level of CD3+ : 40.5±5.1, CD4+ : 27.3±6.4 and the ratio of CD4+ /CD8+ : 1.8±0.3 were decreased in group A at T3, the cell levels of CD3+ : 54.4±6.0and CD4+ : 32.5±6.9 were decreased in group B at T2, the cell levels of CD3+ : 52.3±5.7and CD4+ : 38.7±7.6 were decreased in group B at T3, the cell levels of CD3+ : 63.3±7.5 and CD4+ 3: 8.2±7.0 were decreased in group C at T2, the cell levels of CD3+ : 60.4±7.4and CD4+ : 42.5±7.4 were decreased in group C at T3 (P=0.000); Compared with group A, the cell level of CD3+ and CD4+ were increased in group B, C at T2 and T3 (ibid), the ratio of CD4+ /CD8+ : 1.9±0.1 was increased in group B at T2, CD4+ /CD8+ : 2.1±0.2 at T3, the ratio of CD4+ /CD8+ : 2.2±0.2 was increased in group C at T2, CD4+ /CD8+ : 2.2±0.2 at T3 (P=0.000); Compared with group B, the cell level of CD3+ , CD4+ and the ratio of CD4+ /CD8+ were increased in group C at T2 and T3 (ibid) (P=0.000). Compared with group A and B, the concentration of the norepinephrine (NE), epinephrine (E), cortisol (Cor) and the dosage of propofol, remifentanil in the period of the surgery and the utilization rate of vasoactive drug in the convalescent period were decreased in group C at T1-T3; Compared with group A, the concentration of the norepinephrine (NE), epinephrine (E), cortisol (Cor) and the dosage of propofol, remifentanil in the period of the surgery and the utilization rate of vasoactive drug in the convalescent period were decreased in group B at T1-T3. Conclusion The pretreatment of nalbuphine pretreatment combined with ultrasound-guided paraspinal nerve block can improve the the cellular immune function of the patients with lung cancer under thoracoscopic surgery. Key words: Nalbuphine; Nerve block; Immunity cells; Thoracoscopy; Lung cancer