Data from international studies reveal that the mathematics literacy of Spanish students is significantly lower than that of students from nearby countries. Therefore, in recent years, interest in identifying the factors that influence students’ mathematics results in Spain has grown considerably. Often, these factors are sought among the socioeconomic characteristics of the students or among variables related to the schools, ignoring the psychological and emotional factors of the students. This paper analyzes the impact of certain psychoemotional characteristics of Spanish students on their literacy in mathematics. For this purpose, multilevel regression models are applied to the data of the Spanish sample of the 2018 edition of PISA (Programme for International Student Assessment), which is composed of 35,943 15-year-old students. The instruments for data collection are the mathematics literacy tests and the contextual questionnaires on students’ personal situation and well-being used by PISA. As dependent variable, students’ mathematics literacy has been considered, measured through the plausible values provided by PISA, and as independent variables, different indices measuring students’ psychoemotional well-being obtained from the contextual information collected by PISA. Results indicate that resilience, motivation for the achievement of learning objectives, competitiveness, perceived cooperation at school, and social connectedness with parents have a positive impact on students’ mathematics literacy, while experiences related to bullying, physical self-concept, meaning in life and perceived competitiveness at school have a negative impact.