This study aims to investigate the association of serum concentrations of magnesium (Mg), selenium (Se), chromium (Cr), and copper (Cu) with cardiometabolic risk factors and liver functions in Iranian children and adolescents. This case-control study was conducted under a national surveillance program. It comprised 320 students, aged 10-18 years, in two groups of equal number with or without metabolic syndrome (MetS). Serum concentrations of Mg and abovementioned trace elements were measured by atomic absorption spectrophotometry. Median regression analysis and different models of logistic regression were used to determine the associations of these elements with cardiometabolic risk factors. In the MetS group, the median of Mg, Se, Cr, and Cu was lower or equal to controls. Mg had significant inverse association with some MetS components; however, the corresponding figure was stronger for the simultaneous association of Mg, Se, Cr, and Cu with MetS components. The binary logistic regression revealed that Mg was a significant protective factor against MetS (P = 0.0001). Likewise, by considering the simultaneous association of Mg, Se, Cr, and Cu with MetS, Se was a significant protective factor against MetS. The corresponding figures were not significant for Cr and Cu. Se and Cu had significant inverse association with liver enzymes. The protective role of Mg and Se against MetS and liver enzymes, as well as the associations of these elements with some cardiometabolic risk factors and liver enzymes in the pediatric age group should be considered in future preventive and interventional studies.