Prevalence estimates of obesity in a national random sample of Spanish children and young people are presented in this paper, defined by age- and sex-specific BMI national reference standards for the 85th percentile (overweight) and 97th percentile (obesity), as well as by Cole et al. criteria. A random sample of 3534 people, aged 2–24 years, was interviewed between 1998 and 2000. The study protocol included personal data, data on education and socioeconomic status (SES) for the family, dietary assessment, anthropometric measurements and physical activity. The prevalence of obesity was 13·9 % (95 % CI 12·7, 15·1) considering Spanish reference standards as cut-offs. Obesity was significantly higher in boys (15·6 %) than in girls (12 %). The highest values were observed between 6 and 13 years of age. Using Cole's cut-offs, the estimated prevalence of obesity was 6·3 % (95 % CI 5·4, 7·5) with a similar pattern to that previously described by sex. Regarding sociodemographic factors, sex, age group, region, size of locality of residence, mother's level of education and family SES level were significant predictors for obesity in children and adolescents under 14 years. Among young people, the main sociodemographic predictors for obesity were geographical region and family SES level. Odds ratio for obesity was 1·27 for those with a more frequent consumption of buns, cakes and snacks, and 1·71 for those with more frequent consumption of sugared drinks. Adequate consumption of fruit and vegetables, usually having breakfast and regular sports practice had a protective effect. The available data show that obesity in Spain is a public health issue given its magnitude and increasing trends. Among Spanish children and young people, those at prepubertal age, particularly boys, can be identified as a group at higher risk for overweight and obesity, particularly children from lower SES families.