Macrophages have been reported to exert a crucial role in hepatocellular carcinoma (HCC). This study aimed to explore the macrophage-related genes and establish a macrophage-related signature (MRS) model to predict the overall survival (OS) of patients with HCC based on these genes’ expression. We screened the macrophage-related gene module by weighted gene coexpression network analysis (WGCNA), the least absolute shrinkage and selection operator (LASSO) Cox regression analysis was utilized for further selection, and the selected genes were entered into stepwise regression to develop the MRS model, which was further validated in the Gene Expression Omnibus (GEO) and International Cancer Genome Consortium (ICGC) datasets. We analyzed the biological phenotypes associated with macrophages in terms of functional enrichment, tumor immune signature, and tumor mutational signature. The patient’s response to immunotherapy was inferred by the tumor immune dysfunction and exclusion (TIDE) score, the immunophenotype score (IPS), and the IMvigor210 dataset. A novel MRS model was established based on the LASSO regression coefficients of the genes PON1, IL15RA, NEIL3, HILPDA, PFN2, HAVCR1, ANXA10, CDCA8, EPO, S100A9, TTK, KLRB1, SPP1, STC2, CYP26B1, GPC1, G6PD, and CBX2. In either dataset, MRS was identified as an independent risk factor for OS in HCC patients. Additionally, our research indicated that a high-risk score in the MRS model was significantly correlated with tumor staging, pathological grade, tumor–node–metastasis (TNM) stage, and survival. Several genes of the human leukocyte antigen (HLA) family and immune checkpoints were highly expressed in the high-risk group. In addition, the frequency of tumor mutations was also higher in the high-risk group. According to our analyses, a higher risk score in the MRS model may predict a better response to immunotherapy.