Hepatocellular carcinoma (HCC) is a highly lethal liver cancer with significant heterogeneity, which poses challenges in predicting prognosis and treatment outcomes. The impact of iron metabolism and immune-related genes (IMRGs) on HCC patient prognoses remains elusive. We utilized The Cancer Genome Atlas (TCGA) dataset to obtain mRNA expression data and clinical information from HCC patients. Through the application of LASSO regression and univariate/multivariate Cox regression analyses, we identified five IMRGs significantly associated with survival of HCC patients. We constructed a prognostic model comprising these five genes. The model demonstrated excellent predictive performance, not only within TCGA dataset but also when validated using the Gene Expression Omnibus (GEO) dataset. Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) enrichment analyses presented significant variations in functional categories, such as apical plasma membrane and collagen-containing extracellular matrix. Several pathways, including the PI3K-AKT signaling pathway and the calcium signaling pathway, exhibited significant variations among HCC patients with varying prognoses (P < 0.05). Immune infiltration analysis indicated significantly lower levels of various immune cells, immune functions, and immune checkpoints, such as B cells, CD8+ T cells, and TILs, in the high-risk group (P < 0.05). Immunophenoscore results suggested that the low-risk group may exhibit a more favorable response to immune therapy. Furthermore, the CellMiner database predicted anti-tumor drugs significantly associated with prognostic genes (P < 0.001). In conclusion, our findings highlight the predictive role of IMRGs in prognosis and immune treatment of HCC, indicating that ADAMTS13, CRHBP, VIPR1, FCN3, and CLEC1B may serve as potential prognostic biomarkers for HCC.