Gastric cancer (GC) is one of the most common malignant tumors with high incidence and mortality rates. Most patients with GC are not diagnosed until the advanced stage of cancer or during tumor screening, resulting in missing the best treatment time. This study identified key modules and hub genes associated with GC by weighted gene co-expression network analysis (WGCNA). The "limma" package in R was used to identify differentially expressed genes (DEGs) in GC samples from TCGA, and a total of 4892 DEGs were identified. GO enrichment and KEGG pathway enrichment analyses were conducted to detect the related pathways and functions of DEGs. These DEGs were primarily associated with extracellular matrix organization, DNA replication, cell cycle, and p53 signaling pathway. Gene modules associated with clinical characteristics were identified with WGCNA in tumor and normal samples. Six gene modules were obtained in the WGCNA network, of which two modules were significantly correlated with GC. Hub genes of key modules were identified using survival analysis and expression analysis. Finally, one-way ANOVA was used to explore the relationship between hub gene expression in normal tissues and different pathological stages of GC. Through survival and expression analysis, a total of 19 genes with good prognosis and significantly differential expressed were identified. The hub genes were significantly differential expressed in normal tissues and different pathological stages of GC, indicating that these genes have important diagnostic value for early GC and can be used as auxiliary indicators in the diagnosis of early GC.