The officer, whose name was not immediately released, was the first member of the Galt Police Department to be killed in the line of duty since the department was organized in 1946.
The Sacramento Sheriff's Department said the suspect was also dead, apparently from a self-inflicted gunshot to the head.
A witness told KCRA-TV in Sacramento the officer was chasing the suspect through a field near the apartment complex when he turned and stabbed the officer and then ran off. Another officer responding to the scene reported hearing a gunshot. The witness's account of the stabbing was not immediately confirmed by deputies.
The suspect apparently killed himself when he was cornered by pursuing officers near a railroad. KCRA said deputies were looking into the possibility the backup officers exchanged fire with the suspect.
Beyonce flaunts bikini body, Blue Ivy in vacation pics
Couple mistakenly served bag of cash at McDonald's drive-thru