The Stockton Police Department announced on Twitter that the officer and the suspect were transported to a hospital after a shooting earlier in the day.
The officer has been identified as 30-year-old Jimmy Inn.
Police dispatchers received a call around 9:45 a.m. Tuesday reporting a domestic disturbance. The caller reported hearing screaming and seeing a woman wearing a ripped shirt and bleeding. She appeared to have been assaulted.
Inn arrived at the home at 10:07 a.m. and was shot almost immediately in front of the home by a male suspect, Stockton Police Chief Eric Jones said.
"It was a violent, blatant and very sudden assault on our police officer," the chief said.
RELATED: Authorities identify San Luis Obispo police officer killed while serving search warrant
A second officer, whose name was not released, arrived and exchanged gunfire with the suspect. The suspect then went into the home and returned moments later holding a young child.
The suspect began to strangle the child, an 8-year-old boy, Jones said. The officer opened fire again as a bystander tackled the suspect.
The suspect's name has not been released. He died at the hospital. It was not immediately clear what relationship he had with the woman and the child.
Inn, 30, is survived by his wife, who is also a Stockton police officer, as well as a 7-month old son, 12-year-old stepdaughter and a 14-year-old stepson.
He was hired by the police department in December 2015, Jones said. Remembered as an optimistic officer who was popular in the department, Inn was assigned to the Field Operations Division and served in the honor guard.
The shooting comes a day after another California police officer was shot and killed. In San Luis Obispo, about 250 miles south of Stockton, Detective Lucas "Luca" Benedetti was shot and killed while serving a search warrant Monday evening.
The deaths occurred during National Police Week, an annual event that honors law enforcement officers who were killed or disabled in the line of duty.
The Associated Press contributed to this report.