This study examines the factors affecting the mathematics achievement of 8th-grade students in Türkiye using data from the TIMSS in 2011, 2015, and 2019. The data were analysed with multilevel (two-level) modelling. The first level was the student, and the second level was the school. At the student level, such affective characteristics as self-confidence in learning mathematics, liking to learn mathematics, and value given to learning mathematics, as well as educational resources, namely at home, gender, and the frequency of speaking the language of the test at home, were taken into consideration. At the school level, the school’s socioeconomic status was included in the model. The results showed that self-confidence in learning mathematics is the most important variable affecting students' mathematics achievement in all years. Besides, the school’s socioeconomic status has the strongest effect on students' mathematics achievement, which has increased over the years. The study also showed that those students who performed higher achievement in TIMSS 2011, 2015, and 2019 are confident in learning mathematics, have many educational resources at home, frequently speak Turkish at home, and are from affluent schools. On the other hand, for TIMSS 2011 and 2019, female students were more successful than male students. The effect of liking to learn mathematics on achievement was negative and significant only for TIMSS 2015, while the effect of value given to learning mathematics was positive and significant only for TIMSS 2019. However, the effect size values of the variables showed that this effect was not significant in practice.