A second student was also wounded and was in stable condition at a local hospital.
The shooting, which San Bernardino Police Chief Jarrod Burguan said was a murder-suicide, happened shortly before 10:30 a.m. inside a special-needs classroom at North Park Elementary School in the 5300 block of North H Street.
Police identified the gunman as Cedric Anderson, 53, of Riverside.
They say he entered the classroom and, without saying a word, shot and killed his estranged wife, Karen Elaine Smith, 53. They had only been married a few months and were estranged for about a month, Burguan said.
It was not immediately known how many shots he fired, but the weapon, a .357 revolver, typically carries six rounds and he reloaded once before turning the gun on himself, Burguan said.
Two students were behind Smith and struck by gunfire. Both were airlifted to Loma Linda University Medical Center.
One student, identified as Jonathan Martinez, 8, died before making it to surgery, officials said. The other student, a 9-year-old, was in stable condition in the hospital.
PHOTOS: San Bernardino elementary school shooting
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.
The shooting happened in a special needs classroom that included students from grades 1-4. At the time, the room held 15 students, one teacher and two adult aides.
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. He told staff he was there to drop something off to his wife.
The school was on lockdown until further notice and officials said it was expected to be closed for at least the next two days.
Burguan said Anderson has a criminal history which includes domestic violence, weapons and drug charges. The domestic violence charges, he said, preceded his marriage to Smith. Investigators are still looking into the reason for their estrangement.
Officers have secured his residence in Riverside and did not find any other victims there, Burguan said. They are working to obtain a search warrant for the home. So far they have not found any notes from Anderson.
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:
San Bernardino Mayor R. Carey Davis said a prayer vigil will be held tonight at 6 p.m., at Our Lady of the Assumption Church, at 796 W. 48th St.
Prayer Vigil- Our Lady of the Assumption Church - 796 W. 48th Street, SB. pic.twitter.com/KJvvPJc7QG— Mayor R. Carey Davis (@SBMayorDavis) April 10, 2017
The San Bernardino County District Attorney's Office has a victim services counseling line for anyone who may be traumatized by the event: 909-382-3846.
Support and counseling services for students and parents will also be available Tuesday at Del Vallejo Middle School.
DEVELOPING: We will add more details to this report as they become available.