By Agence France-Presse
A boy was shot in the head, while a girl was hit in the wrist, emergency services personnel said, confirming that a 12-year-old girl was arrested over the incident.
Paramedics sent to Salvador Castro Middle School in the central Westlake area at 9:00 am (1700 GMT) said both students were taken to hospital, with the boy in critical but stable condition and the girl faring better.
Officials at Los Angeles County and USC Medical Center said both students were expected to make full recoveries with staff describing the boy as "extremely lucky."
"The trajectory of the bullet did not hit any vital structures that were an immediate threat to life. So I think he will do fine," said Aaron Strumwasser, who treated the teens.
An 11-year-old boy, a 12-year-old girl and a 30-year-old woman "had minor abrasions to the face area, some from glass," Erik Scott of the Los Angeles Fire Department said, adding that none of the three were struck by gunfire.
Officers arriving after the alarm was raised "located a few victims and they also located the suspect, who they took into custody without further incident," Los Angeles police Lieutenant Chris Ramirez said.
"A gun was recovered at (the) scene."
Aerial TV footage showed a handcuffed female suspect being taken into custody and placed into a patrol car while police went room to room, leading many students out with their hands behind their backs.
The middle school is located in a building across the street from the main Belmont High School. The entire school complex remained under lockdown for several hours before authorities announced around noon that lessons could resume, with counselors provided in each classroom.
"We could not control or know about this situation, but our schools are safe," said Vivian Ekchian, interim superintendent of the Los Angeles Unified School District.
Mayor Eric Garcetti told the local ABC7 news channel at the scene that it was unclear if the shooting was intentional or accidental.
Chief Steve Zipperman of the Los Angeles School Police Department added that it was not known what prompted the gunfire or how the weapon wound up on the secure campus.
"We have laws that mandate that parents who own guns, any adult who owns guns, any gun owner has an obligation to ensure that gun is locked inside a home," he added.
Zipperman said a main focus would be caring for students who may have witnessed the shooting.
"We know this is a very traumatic incident for all the children involved, particularly inside that classroom," he added.
'Call to action'
Zipperman declined to provide specifics about security measures at the campus, but said every secondary school in the district had "policies and procedures" in place to protect students.
It is the most high-profile incident involving gun violence at a school in California since four people were killed and nearly a dozen wounded in November last year when a gunman went on a rampage, randomly picking his targets.
The assailant was killed by police following the mass shooting in Rancho Tehama Reserve, northern California, which unfolded over several locations in the community, including an elementary school.
The latest shooting will reignite the long-running debate on America's epidemic of gun violence and the ready accessibility of weapons, with 33,000 people dying annually from gun-related deaths.
Los Angeles City Attorney Mike Feuer said the shooting should be a "call to action" for gun owners to ensure weapons are kept away from children while Los Angeles County Supervisor Hilda Solis said she was "horrified" by events.
"Our schools should be safe spaces for our children to grow, learn and play," she added.
"Today, this innocence was ripped from them as a result of a minor who had access to a gun. This needs to stop."