The suspect was booked at Eastlake Juvenile Hall on a charge of negligent discharge of a firearm on school grounds, the official said, adding that police believe the shooting was accidental. She was being held without bail.
The two 15-year-old victims, one boy and one girl, were transported to a local trauma center after the shooting. The boy was listed in critical but stable condition from a gunshot wound to the head, and the girl was listed in fair condition after being shot through the wrist, the Los Angeles Fire Department said.
A seventh-grader who was in the classroom at the time of the shooting said he believed the shooting was accidental. "They thought it was a toy gun, but then it shot," Benjamin Urbina said, describing a "big pop" after the firearm went off.
The boy said the girl who was holding the gun "didn't mean to" shoot the 15-year-old girl who was injured.
Three others -- a 30-year-old woman, an 11-year-old boy and a 12-year-old girl -- suffered minor injuries due to shrapnel or broken glass, officials said.
Officials at LAC+USC Medical center said they received four patients from the incident, which included all the minors but not the 30-year-old woman.
Doctors said the 15-year-old boy was shot in the left temple and was awake, alert and answering questions when he initially arrived at the hospital. He was listed in stable condition in the intensive care unit.
"This child was extremely lucky," Dr. Aaron Strumwasser said during a news conference at the medical center. "The trajectory of the bullet did not hit any vital structures that were an immediate threat to life. ... I anticipate that he will make a full recovery."
The 15-year-old girl suffered a gunshot wound to the right wrist, doctors said, and she was said to be resting comfortably in the hospital's emergency department. She is also expected to make a full recovery. The 11-year-old boy and the 12-year-old girl, who suffered minor injuries from shrapnel or graze wounds, were treated and released, doctors said.
"Our children now see more shootings and deaths than we ever did in my lifetime," said Inez Beckon-English, the hospital's assistant director of clinical social work. "(They) pretty much can be afraid to go to school to get an education because so many shootings are taking place."
WATCH: Doctors provide updates on teens shot at Sal Castro Middle School
According to police, the suspect was taken into custody at the scene without incident. A semi-automatic handgun was recovered inside the classroom.
Eyewitness News has learned the girl and her father were at the LAPD's Rampart station on Thursday afternoon, where she was questioned by detectives.
In a brief interview, her Spanish-speaking grandmother described the 12-year-old as "amorosa" and "cariñosa" -- loving and caring. The woman said her granddaughter did not have many friends and had been bullied by another girl.
It is unclear how the alleged shooter got a hold of a gun.
MORE: Sal Castro student calls brother, 'Someone just got shot, I need you'
Sal Castro Middle School was placed on temporary lockdown as police searched the school as part of the shooting investigation.
Police officers swarmed the campus after the shooting was reported shortly before 9 a.m. Sal Castro Middle School is located on the campus of Belmont High School, Los Angeles School Police said. Approximately 50 LAFD firefighters and seven ambulances responded to the incident.
"As a parent, this is everyone's worst-case nightmare," LAPD Deputy Chief Bobby Arcos said at a news conference at the scene, adding that the response by police officers and firefighters was "extraordinary."
Investigators said the shooting happened inside a classroom during a mixed-grade elective class. The school was declared safe and there was no immediate threat to the campus.
WATCH: Shaken students, parents react to shooting at Sal Castro Middle School
Officials confirmed that although the campus was temporarily on lockdown, a normal school day was expected to resume with dismissal at 3:05 p.m. as usual.
"We were in the gym for, like, five hours and we couldn't do nothing," one girl said as she held back tears. "We were there and they wouldn't let us out until, like, right now they let us out."
Vivian Ekchian, LAUSD's interim superintendent, said the district will provide emotional support to students and parents in the coming days.
A hotline has been set up for Sal Castro Middle School parents: (213) 241-1000. Anyone with information about the shooting is asked to call LAPD Rampart Division detectives at (213) 484-3660.