Objective To compare the efficacy of erlotinib and pemetrexed in treatment of advanced non-small cell lung cancer (NSCLC) and its effect on the immunity of patients. Methods A total of 82 patients with NSCLC at the First Affiliated Hospital of Hainan Medical College from June 2014 to May 2018 were retrospectively analyzed. According to the different treatment methods, the patients were divided into erlotinib group (150 mg/d, oral administration, 2 hours after the meal) and pemetrexed group (500 mg/m2, intravenous drip, 21-day each cycle). There were 41 cases in each group. The clinical effects of the two groups were analyzed. Flow cytometry was used to detect the immune index. Results The objective effective rate in pemetrexed group was lower than that in erlotinib group [34.2% (14/41) vs. 39.0% (16/41), χ2 = 0.210, P = 0.647). There was no significant difference in T lymphocyte subsets between the two groups before and after treatment (both P > 0.05). The values of CD3+ T cells, CD4+ T cells, CD4+/CD8+ in both groups after the treatment were decreased compared with the values before the treatment; CD8+ T cells was increased after the treatment compared with the value before the treatment (all P < 0.05). Quality of life questionnaire-C30 (QLQ-C30) score in erlotinib group was higher than that in pemetrexed group [(75.1±13.5) vs. (68.9±12.9), t = 2.158, P = 0.017]. Myelosuppression and gastrointestinal reactions were the main adverse events in pemetrexed group; rashes and diarrhoea were the main adverse reactions in erlotinib group. Grade Ⅰ-Ⅱ side effects occurred in both groups. There were statistical differences in the incidence of myelosuppression, gastrointestinal reactions, rashes and diarrhoea of both groups (all P < 0.05). Conclusions The efficacy of erlotinib and pemetrexed in treatment of advanced NSCLC is similar, and both of them could regulate the immune response. Erlotinib has a significant advantage in improving the quality of life. Key words: Carcinoma, non-small cell lung; Erlotinib; Pemetrexed; T-lymphocyte subsets; Adverse reactions