Hepatic glucose and lipid metabolism disorders promote the development and progression of type 2 diabetes mellitus (T2DM), yet the underlying mechanisms are not fully understood. Here, we identify tripartite motif-containing protein 21 (TRIM21), a class IV TRIM family member, as a pivotal regulator of hepatic metabolism in T2DM for the first time. Bioinformatic analysis suggests that TRIM21 expression is significantly reduced in T2DM patients. Intriguingly, in a mouse model of obese diabetes, TRIM21 expression is predominantly reduced in the liver rather than in other metabolic organs. It is further demonstrated that hepatic overexpression of TRIM21 significantly ameliorates glucose intolerance, insulin resistance, hepatic steatosis, and dyslipidemia in obese diabetic mice. In contrast, the knockdown of TRIM21 promotes glucose intolerance, insulin resistance, and triglyceride accumulation. Mechanistically, both phosphoenolpyruvate carboxykinase 1 (PEPCK1) and fatty acid synthase (FASN) are the hepatic targets of TRIM21. We revealed that TRIM21 promotes the degradation of PEPCK1 and FASN through a direct protein–protein interaction mediated K48-linked ubiquitination. Notably, overexpression of PEPCK1 and FASN essentially abolished the beneficial effects achieved by TRIM21 overexpression in obese diabetic mice. Overall, our data demonstrate that TRIM21 is a novel regulator of hepatic metabolic disorder, and suggest TRIM21 as a promising therapeutic target for T2DM.Supplementary InformationThe online version contains supplementary material available at 10.1007/s00018-023-04820-w.