Background: The prognosis of hepatocellular carcinoma (HCC) patients remains poor. Identifying prognostic markers to stratify HCC patients might help to improve their outcomes. Methods: Six gene expression profiles (GSE121248, GSE84402, GSE65372, GSE51401, GSE45267 and GSE14520) were obtained for differentially expressed genes (DEGs) analysis between HCC tissues and non-tumor tissues. To identify the prognostic genes and establish risk score model, univariable Cox regression survival analysis and Lasso-penalized Cox regression analysis were performed based on the integrated DEGs by robust rank aggregation method. Then Kaplan-Meier and time-dependent receiver operating characteristic (ROC) curves were generated to validate the prognostic performance of risk score in training datasets and validation datasets. Multivariable Cox regression analysis was used to identify independent prognostic factors in liver cancer. A prognostic nomogram was constructed based on The Cancer Genome Atlas (TCGA) dataset. Finally, the correlation between DNA methylation and prognosis-related genes was analyzed. Results: A twelve-gene signature including SPP1, KIF20A, HMMR, TPX2, LAPTM4B, TTK, MAGEA6, ANX10, LECT2, CYP2C9, RDH16 and LCAT was identified, and risk score was calculated by corresponding coefficients. The risk score model showed a strong diagnosis performance to distinguish HCC from normal samples. The HCC patients were stratified into high-risk and low-risk group based on the cutoff value of risk score. The Kaplan-Meier survival curves revealed significantly favorable overall survival in groups with lower risk score (P < 0.0001). Time-dependent ROC analysis showed well prognostic performance of the twelve-gene signature, which was comparable or superior to AJCC stage at predicting 1-, 3-, and 5-year overall survival. In addition, the twelve-gene signature was independent with other clinical factors and performed better in predicting overall survival after combining with age and AJCC stage by nomogram. Moreover, most of the prognostic twelve genes were negatively correlated with DNA methylation in HCC tissues, which SPP1 and LCAT were identified as the DNA methylation-driven genes. Conclusions: We identified a twelve-gene signature as a robust marker with great potential for clinical application in risk stratification and overall survival prediction in HCC patients.