This paper reports the construction of an index to measure the socioeconomic status of the families of primary school students. The working data concerned 65,144 students who were enrolled at 2,069 schools that participated in a diagnostic evaluation conducted in Andalusia in 2008-2009. The researchers worked with the results of tests gauging the subjects' basic competencies (in mathematics, linguistic communication and science) and the answers given by their parents to questionnaires about the characteristics of their home environment. The variables used to construct the index included the father's and mother's educational and occupational levels, the number of books at home and home resources (appropriate place of study, desk, PC, Internet connection, digital, cable or satellite TV, reference materials and supplementary educational materials). Principal component analysis was used to reduce the variables to an index of the student's socioeconomic status (ISE), which enabled an average index to be calculated for each school. To assess the index's goodness, the ISE values of each school were compared to the data collected in the diagnostic evaluation carried out the year before at the same schools. A high correlation was found. The predictive validity and concurrent validity of the index were also analysed. Students with a low ISE were found to earn lower marks in basic competencies than did students with a high ISE. Furthermore, the schools that had participated in government-sanctioned compensatory plans could be detected by their ISE as schools of a low socioeconomic status.