The shooting took place at the Saugus High School in Santa Clarita, north of Los Angeles, minutes before the school day was due to begin.
The male suspect, who was also injured, is now in custody.
Many US schools have implemented active shooter drills in recent years, following a string of attacks.
The shooting was first reported at 07:38 local time (15:38 GMT), LA county sheriff Alex Villanueva told a press conference.
"Within seconds we received multiple [emergency] calls," he said, adding that the first police units had arrived at the scene within two minutes.
Police found six people suffering from gunshot wounds and transferred them to local hospitals - and the suspect was later identified as one of those injured, Mr Villanueva said.
Two victims - a 16-year-old girl and a 14-year-old boy - died of their injuries, he added.
The other victims were two girls aged 15 and 14, and a 14-year-old boy.
The suspect was "identified as a 16-year-old male whose birthday was today", he added.