Universities are looking for solutions to engage more students in STEM domains and enhance their learning performance (LP). In this context, gamification is put forward as a solution to achieve this aim. The present study examined the effect of gamification – building on leaderboards ‐ on LP. Furthermore, mediating variables, such as intrinsic motivation, self‐efficacy, engagement, and background variables, such as sex, previous gaming experience, and undergraduate major, were considered. A pretest‐posttest quasi‐experimental design with an experimental and a control condition was set up (n = 89) in an Introductory Computer Programming course. We observed a significant improvement in the LP of students in the gamified condition. However, no interaction effect was detected, due to mediating and background variables. The high learning gain is a favorable indicator that gamification might be a promising approach to promote STEM programs.