Abstract Background Stomach adenocarcinoma (STAD) is the most common histological type of stomach cancer, which causes a considerable number of deaths worldwide. This study specifically aimed to identify potential biomarkers and reveal the underlying molecular mechanisms. Methods Gene expression profiles microarray data were downloaded from the Gene Expression Omnibus (GEO) database. The ‘limma’ R package was used to screen the differentially expressed genes (DEGs) between STAD and matched normal tissues. The Database for Annotation, Visualization, and Integrated Discovery (DAVID) was used for function enrichment analyses of DEGs. The data of STAD cases with both RNA sequencing and clinical information of The Cancer Genome Atlas (TCGA) were obtained from Genomic Data Commons (GDC) data portal. Survival curves were analyzed by the Kaplan-Meier method, univariate Cox regression analysis and multivariate Cox regression were performed using ‘survival’ package. CIBERSORT algorithm used approach to characterize the 22 human immune cell composition. Gene expression profiles microarray data and clinical information were downloaded from GEO database to validate prognostic model. Results Three public datasets including 90 STAD patients and 43 healthy controls were used and 44 genes were differentially expressed in all three datasets. These genes were primarily implicated in biological processes including cell adhesion, wound healing and extracellular matrix organization. Seven out of 44 genes showed significant survival differences based on their expression differences. CTHRC1 and LRFN4 were eventually used to constructed risk score and prognostic model by univariate Cox regression and stepwise multivariate Cox regression in The Cancer Genome Atlas (TCGA)-STAD dataset. The group having high risk scores and the group having low risk scores had significant differences in the infiltration level of multiple immune cells including CD4 memory resting T cells, M2 macrophages, memory B cells, resting dendritic cells, eosinophils, and gamma delta T cells. Multivariate Cox regression analyses indicated that the risk score was an independent predictor after adjusting for age, sex, and tumor stage. At last, the model was verified and evaluated by another independent dataset and showed a good classification effect. Conclusions The present study constructed the prognostic model by expression of CTHRC1 and LRFN4 for the first time via comprehensive bioinformatics analysis, which may provide clinical guidance and potential therapeutic targets for STAD.