Tripartite motif-containing protein 5α (TRIM5α) is generally known to block the postentry events of HIV-1. Here, we report an uncharacterized role for TRIM5α in the maintenance of viral latency. Knockdown of TRIM5α potentiates the transcription of HIV-1 in multiple latency models, which is reversed by shRNA-resistant TRIM5α. TRIM5α suppresses TNFα-activated HIV-1 LTR-driven as well as NF-κB- and Sp1-driven gene expression, with the RING and B-box 2 domains being the essential determinants. Mechanistically, TRIM5α binds to and enhances the recruitment of histone deacetylase 1 (HDAC1) to NF-κB p50 and Sp1. ChIP‒qPCR analyses further reveal that the association of TRIM5α with HIV-1 LTR induces HDAC1 recruitment and local H3K9 deacetylation. Conserved suppression effects of TRIM5α orthologs from multiple species on both HIV-1 and endo-retroelement HERV-K LTR activities have also been demonstrated. These findings provide new insights into the molecular mechanisms by which proviral latency is initially established and activatable proviruses are resilenced by histone deacetylase recruitment.