The shooting, which San Bernardino Police Chief Jarrod Burguan said was a murder-suicide, happened shortly before 10:30 a.m. inside a classroom at North Park Elementary School in the 5300 block of North H Street.
Police identified the suspect as Cedric Anderson, 53, of Riverside. They say he shot and killed his wife, Karen Elaine Smith, 53.
Two students were behind Smith and struck by gunfire. Both were transported to a local hospital.
One student, identified as Jonathan Martinez, 8, later died, Burguan said. The other student, a 9-year-old, was in stable condition in the hospital.
PHOTOS: San Bernardino elementary school shooting
Burguan said two adults were killed, and two students were hospitalized in critical condition. A female teacher was shot and killed by the suspect, who was visiting her at the time. The gunman then turned the gun, which authorities said was a handgun, on himself.
Police said the children shot were not targeted and were likely struck by accident. The parents of the students who were shot have been notified, according to authorities.
Two adults are deceased in a classroom, believed to be a murder suicide. We believe the suspect is down and there's no further threat.— Chief Jarrod Burguan (@SBPDChief) April 10, 2017
The gunman had signed in and was known by staff at the school, police said. The school was on lockdown until further notice and officials said it was expected to be closed for at least the next two days.
VIDEO: Police address San Bernardino elementary school shooting
Hillside Elementary School and Cajon High School were on a precautionary lockdown as emergency crews responded to aid the victims.
Students at North Park Elementary were escorted to Cal State University, San Bernardino's PE Building 100.
AIR7 HD captured the emotional scene as children were reunited with their parents at Cajon High School.
Parents and guardians were asked to bring their ID to Cajon High School for identification and verification and will be escorted to CSUSB, school officials said.
Burguan asked for patience from family members as the process could take up to three hours.
U.S. Secretary of Education Betsy DeVos released the following statement on the shooting:
"My heart and prayers go out to the victims of this horrible act and to all students and members of the North Park Elementary School community. I want to thank the first responders, teachers and school administrators who were there to protect the students in harm's way. As a mother and grandmother, today's senseless violence is a tragedy no parent should ever have to face. I ask everyone to join me in keeping all the victims and those impacted in your prayers."