Background : In this study, we comprehensively analyzed genes related to ferroptosis and iron metabolism to construct diagnostic and prognostic models and explore the relationship with the immune microenvironment in HCC. Methods : Integrated analysis, cox regression and the least absolute shrinkage and selection operator (LASSO) method of 104 ferroptosis- and iron metabolism-related genes and HCC-related RNA sequencing were performed to identify HCC-related ferroptosis and iron metabolism genes. Results : four genes (ABCB6, FLVCR1, SLC48A1 and SLC7A11) were identified to construct prognostic and diagnostic models. Poorer overall survival (OS) was exhibited in the high-risk group than that in the low-risk group in both the training cohort (P < 0.001, HR = 0.27) and test cohort (P < 0.001, HR = 0.27). The diagnostic models successfully distinguished HCC from normal samples and proliferative nodule samples. Compared with low-risk groups, high-risk groups had higher TMB; higher fractions of macrophages, follicular helper T cells, memory B cells, and neutrophils; and exhibited higher expression of CD83, B7H3, OX40 and CD134L. As an inducer of ferroptosis, erastin inhibited HCC cell proliferation and progression, and it was showed to affect Th17 cell differentiation and IL-17 signaling pathway through bioinformatics analysis, indicating it a potential agent of cancer immunotherapy. Conclusions: The prognostic and diagnostic models based on the four genes indicated superior diagnostic and predictive performance, indicating new possibilities for individualized treatment of HCC patients.