A police officer fatally shot a man in Coney Island after the assailant stabbed the transit cop in the head and shoulder with a 12-inch hunting knife.

The incident happened around 1:17 p.m. in the street below the elevated Q line at Ocean Parkway. 

Police Commissioner Bill Bratton said Officer Fillippo Gugliara was on the Q platform when he heard a man arguing with an elderly woman in the street below. When the officer went to investigate, the man pulled a knife and stabbed the cop, who then fired two rounds at the man.  

The man, 58, was pronounced dead at the scene, and responding officers recovered the knife, police said. 

The officer was taken to Lutheran Hospital with head and shoulder injuries. Doctors said at a press conference the wound was superficial and the officer just needed stitches.