Background Pancreatic cancer is a highly malignant solid tumor with a high lethality rate, but there is a lack of clinical biomarkers that can assess patient prognosis to optimize treatment. Methods Gene-expression datasets of pancreatic cancer tissues and normal pancreatic tissues were obtained from the GEO database, and differentially expressed genes analysis and WGCNA analysis were performed after merging and normalizing the datasets. Univariate Cox regression analysis and Lasso Cox regression analysis were used to screen the prognosis-related genes in the modules with the strongest association with pancreatic cancer and construct risk signatures. The performance of the risk signature was subsequently validated by Kaplan–Meier curves, receiver operating characteristic (ROC), and univariate and multivariate Cox analyses. Result A three-gene risk signature containing CDKN2A, BRCA1, and UBL3 was established. Based on KM curves, ROC curves, and univariate and multivariate Cox regression analyses in the TRAIN cohort and TEST cohort, it was suggested that the three-gene risk signature had better performance in predicting overall survival. Conclusion This study identifies a three-gene risk signature, constructs a nomogram that can be used to predict pancreatic cancer prognosis, and identifies pathways that may be associated with pancreatic cancer prognosis.