Police responded to a domestic disturbance call at an apartment complex in the 7000 block of Fellers Lane in Sebastopol at around 11:30 a.m.
A female caller had called police and said that she was alone in her apartment and her ex-boyfriend was pounding on the back door, police said.
Police said the first officer to arrive encountered an armed suspect before other officers arrived and the officer fired shots at the suspect.
The suspect was pronounced dead at the scene.
The Sebastopol Police Department invoked a countywide "Critical Incident Protocol" and the Santa Rosa Police Department and Sonoma County District Attorney's Office have taken over the investigation, police said.
The name of the deceased is being withheld pending the notification of his next of kin, according to police.
Anyone with information regarding the shooting is asked to call Santa Rosa police at (707) 543-3590.