BackgroundGiven poor prognosis and the lack of efficient therapy for advanced hepatocellular carcinoma, immunotherapy has emerged as an increasingly important role. However, there were few reports on the correlation between immune‐related genes and HCC. The purpose of this study is to construct a novel immune‐related gene‐based prognostic signature for HCC and to explore the potential mechanisms.MethodsWe organized expression data of 374 HCC samples and 50 nontumor samples from TCGA database. A robust signature was constructed by Cox regression analysis based on the immune‐related genes, which were filtered by differential genes analysis and Cox regression analysis. Then, the correlation analysis between the signature and clinical characteristics was conducted. And the signature was validated in ICGC database. Furthermore, the relationships between immune cell infiltration and the signature were explored by bioinformatics analysis.ResultsSeven genes‐based model (Risk score = BIRC5 * 0.0238 + FOS * 0.0055 + DKK1 * 0.0085 + FGF13 * 0.3432 + IL11 * 0.0135 + IL17D * 0.0878 + SPP1 * 0.0003) was constructed eventually and it was proved to be an independent prognostic factor for HCC patients. The signature‐calculated risk scores were shown to be positively correlated with the infiltration of these five immune cells, including macrophages, neutrophils, CD8+T, dendritic, and B cells. And the results suggested that high amplication of BIRC5, FGF13, IL11, IL17D, and SPP1 were more likely correlated with immune cell infiltration. Finally, PPI network, TFs‐based regulatory network and gene enrichment plots were performed to show potential molecular mechanisms.ConclusionWe construct a robust immune‐related gene‐based prognostic signature with seven genes and explore potential mechanisms about it, which may contribute to the immunotherapy research for HCC.