Campaigners are celebrating the ruling, saying giving more children access to sex and relationship information from an early age will be beneficial.
It means faith schools, where sex education has previously been limited, will now teach pupils about sex.
However, parents will still be able to opt children out of these classes.
The ruling is "really important" as it will equip young people with essential information on sex and relationships, Laura Hannah, the education and training manager for leading UK sexual health charity Brook, says.