Academic success and excellence in marks are not only due to the students’ intrinsic abilities or skills. A multitude of contextual variables is involved in the teaching and learning process. This study identifies and analyses the contextual variables that most significantly affect students’ academic performance. We used census data from the ESCALA tests and context questionnaires for the 2016/17 school year, both carried out by the Andalusian Agency for Educational Assessment. Hierarchical Linear Models were used in the data analysis, as they facilitate the control and description of contextual factors. In addition, differences in performance were studied according to the contextual variables that the family dimension encompasses. At all times, a contextualised cross-sectional perspective was considered, taking as a criterion the covariates with significance values lower than 0.01 in the multilevel models and contrast tests. Finally, a list of contextual variables contributing to the explanation of performance is presented. The socio-economic and cultural conditions of families, their expectations towards their children’s education, and their level of involvement in schools have a significant influence on the academic success of primary school students. Academic success is higher among students with families who play an active role and have positive expectations regarding learning.