Lung cancer is one of the leading causes of cancer-related deaths worldwide, and non-small cell lung cancer (NSCLC) accounts for a large proportion of lung cancer cases, with few diagnostic and therapeutic targets currently available for NSCLC. This study aimed to identify specific biomarkers for NSCLC. We obtained three gene-expression profiles from the Gene Expression Omnibus database (GSE18842, GSE21933, and GSE32863) and screened for differentially expressed genes (DEGs) between NSCLC and normal lung tissue. Enrichment analyses were performed using Gene Ontology, Disease Ontology, and the Kyoto Encyclopedia of Genes and Genomes. Machine learning methods were used to identify the optimal diagnostic biomarkers for NSCLC using least absolute shrinkage and selection operator logistic regression, and support vector machine recursive feature elimination. CIBERSORT was used to assess immune cell infiltration in NSCLC and the correlation between biomarkers and immune cells. Finally, using western blot, small interfering RNA, Cholecystokinin-8, and transwell assays, the biological functions of biomarkers with high predictive value were validated. A total of 371 DEGs (165 up-regulated genes and 206 down-regulated genes) were identified, and enrichment analysis revealed that these DEGs might be linked to the development and progression of NSCLC. ABCA8, ADAMTS8, ASPA, CEP55, FHL1, PYCR1, RAMP3, and TPX2 genes were identified as novel diagnostic biomarkers for NSCLC. Monocytes were the most visible activated immune cells in NSCLC. The knockdown of the TPX2 gene, a biomarker with a high predictive value, inhibited A549 cell proliferation and migration. This study identified eight potential diagnostic biomarkers for NSCLC. Further, the TPX2 gene may be a therapeutic target for NSCLC.