Magnesium sulfate was given to pediatric cardiac surgical patients during cardiopulmonary bypass period in an attempt to reduce the occurrence of postoperative junctional ectopic tachycardia (PO JET). We reviewed our data to evaluate the effect of magnesium on the occurrence of JET and assess a possible relationship between PO JET and procedure complexity. A total of 1088 congenital heart surgeries (CHS), performed from 2005 to 2010, were reviewed. A total of 750 cases did not receive magnesium, and 338 cases received magnesium (25 mg/kg). All procedures were classified according to Aristotle score from 1 to 4. Overall, there was a statistically significant decrease in PO JET occurrence between the two groups regardless of the Aristotle score, 15.3 % (115/750) in non-magnesium group versus 7.1 % (24/338) in magnesium group, P < 0.001. In the absence of magnesium, the risk of JET increased with increasing Aristotle score, P = 0.01. Following magnesium administration and controlling for body weight, surgical and aortic cross-clamp times in the analyses, reduction in adjusted risk of JET was significantly greater with increasing Aristotle level of complexity (JET in non-magnesium vs. magnesium group, Aristotle level 1: 9.8 vs. 14.3 %, level 4: 11.5 vs. 3.2 %; odds ratio 0.54, 95 % CI 0.31–0.94, P = 0.028). Our data confirmed that intra-operative usage of magnesium reduced the occurrence of PO JET in a larger number and more diverse group of CHS patients than has previously been reported. Further, our data suggest that magnesium’s effect on PO JET occurrence seemed more effective in CHS with higher levels of Aristotle complexity.