(1) Background: this study evaluates the most relevant factors affecting the performance in mathematics of university undergraduates. Precisely, the mathematical background of students. Spanish secondary education provides an opportunity to develop this analysis since students can choose between two secondary education tracks with different mathematical content and depth. (2) Methods: a survey was conducted covering personal characteristics, socioeconomic status, academic choices and academic achievement as well as a set of questions aimed to uncover attitudes towards mathematics. Students that show preferences regarding mathematics are prone to choose the track with more mathematical content, creating a potential confusion between training and attitudes towards mathematics. We propose an index of non- cognitive skills related to mathematics to account for this problem. (3) Results: prior background in mathematics plays a role in mathematical performance at university even after correcting for non-cognitive skills related to mathematics. The effects are heterogeneous with respect to gender. (4) Conclusions: choosing a more mathematical-oriented itinerary in secondary education seems to give an edge to students. Our results shed light on the implications associated with the decision of secondary school track choice made by students. Furthermore, they are meant to serve as a guide to improve the design of remedial courses.