Background: Metastasis-associated protein 2 (MTA2) is a member of the metastasis-associated transcriptional regulator family and is a core component of the nucleosome remodeling and histone deacetylation complex. Despite growing evidence that MTA2 plays a crucial role in the tumorigenesis of certain cancers, no systematic pan-cancer analysis of MTA2 is available to date. Therefore, the aim of our study is to explore the prognostic value of MTA2 in 33 cancer types and to investigate its potential immune function. Methods: by comprehensive use of databases from TCGA, GTEx, GEO, UCSC xena, cBioPortal, comPPI, GeneMANIA, TCIA, MSigDB, and PDB, we applied various bioinformatics approaches to investigate the potential role of MTA2, including analyzing the association of MTA2 with MSI, prognosis, gene mutation, and immune cell infiltration in different tumors. We constructed a nomogram in TCGA-LIHC, performed single-cell sequencing (scRNA-seq) analysis of MTA2 in hepatocellular carcinoma (HCC), and screened drugs for the treatment of HCC. Finally, immunohistochemical experiments were performed to verify the expression and prognostic value of MTA2 in HCC. In vitro experiments were employed to observe the growth inhibition effects of MK-886 on the HCC cell line HepG2. Results: The results suggested that MTA2 was highly expressed in most cancers, and MTA2 expression was associated with the prognosis of different cancers. In addition, MTA2 expression was associated with Tumor Mutation Burden (TMB) in 12 cancer types and MSI in 8 cancer types. Immunoassays indicated that MTA2 positively correlated with activated memory CD4 T cells and M0 macrophage infiltration levels in HCC. ScRNA-seq analysis based on the GEO dataset discovered that MTA2 was significantly expressed in T cells in HCC. Finally, the eXtreme Sum (Xsum) algorithm was used to screen the antitumor drug MK-886, and the molecular docking technique was utilized to reveal the binding capacity between MK-886 and the MTA2 protein. The results demonstrated excellent binding sites between them, which bind to each other through Π-alkyl and alkyl interaction forces. An immunohistochemistry experiment showed that MTA2 protein was highly expressed in HCC, and high MTA2 expression was associated with poor survival in HCC patients. MK-886 significantly inhibited the proliferation and induced cell death of HepG2 cells in a dose-dependent manner. Conclusions: Our study demonstrated that MTA2 plays crucial roles in tumor progression and tumor immunity, and it could be used as a prognostic marker for various malignancies. MK-886 might be a powerful drug for HCC.