Manhattan Chief of Detectives William Aubry said the officers were responding to an unrelated assault when they noticed the suspect and approached him.
"When he turned around, he violently started swinging," Aubry said.
One officer fired four times, striking the suspect twice.
Police said the man was in critical but stable condition at a hospital. A hammer lay in the middle of the intersection at 37th Street and Eighth Avenue.
More From This Section
On Monday night, a 34-year-old woman was struck in a park. A few hours later, a 28-year-old woman in Union Square noticed a man looking at her, and he then pulled a hammer out of a bag and bashed her head. About 10 minutes later, a 33-year-old was struck from behind.
Officers later discovered that a fourth attack happened earlier Monday in a different part of the city. A 20-year-old man was injured.
Anthony O'Grady, 26, said there was a chase and then the suspect turned around.
"And they shot him," O'Grady said. He said he was in Union Square earlier in the week when one of the hammer attacks occurred.
The investigation is ongoing.