Objective The aim of this study was to analyze the clinical significance and prognostic value of CD8+ T cell-related regulatory genes in hepatocellular carcinoma (HCC). Methods This was a retrospective study. We combined TCGA-LIHC and single-cell RNA sequencing data for Lasso-Cox regression analysis to screen for CD8+ T cell-associated genes to construct a novel signature. The expression of the signature genes was detected at cellular and tissue levels using qRT-PCR, immunohistochemistry, and tissue microarrays. The CIBERSORT algorithm was then used to assess the immune microenvironmental differences between the different risk groups and a drug sensitivity analysis was performed to screen for potential HCC therapeutic agents. Results An 8-gene CD8 + T cell-associated signature (FABP5, GZMH, ANXA2, KLRB1, CD7, IL7R, BATF, and RGS2) was constructed. Survival analysis showed that high-risk patients had a poorer prognosis in all cohorts. Tumor immune microenvironment analysis revealed 22 immune cell types that differed significantly between patients in different risk groups, with patients in the low-risk group having an immune system that was more active in terms of immune function. Patients in the high-risk group were more prone to immune escape and had a poorer response to immunotherapy, and AZD7762 was screened as the most sensitive drug in the high-risk group. Finally, preliminary experiments have shown that BATF has a promoting effect on the proliferation, migration and invasion of HuH-7 cells. Conclusions The CD8+ T-cell-associated signature is expected to be a tool for optimizing individual patient decision-making and monitoring protocols, and to provide new ideas for treatment and prognostic assessment of HCC.