Early childhood education (Educación infantil): This stage is optional and lasts for children between 0 and 6 years old.
Primary education (Educación primaria): Primary education is compulsory and lasts for 6 years, from the age of 6 to 12.
Secondary education (Educación secundaria): Secondary education is compulsory for children aged 12 to 16 and lasts for 4 years.
Upper secondary education (Bachillerato): Upper secondary education is optional and takes 2 years. It is followed by university, vocational training or work experience.
Vocational training (Formación Profesional): Vocational training is aimed at students between 16 and 21 years old and offers practical training in a specific trade or profession.
University (Universidad): University education lasts for 4-6 years and leads to a bachelor's degree.
So, in Spain, students typically attend school for a total of 10-12 years.