Officer Peter Figoski was shot in the face by one of the intruders at the home in Cypress Hills in the city's Brooklyn borough and taken to a hospital where he was pronounced dead, The New York Times reported.
Figoski and fellow officer Glenn Estrada had interrupted a robbery, police said.
"The tenant, an employee of a nearby bodega, said that there were two men, a male Hispanic and a male black who was wearing a ski mask," Police Commissioner Raymond Kelly said in a statement. "They initially claimed to be police officers, the tenant said. They then demanded money and jewelry. They knocked the tenant down, and one of the men struck him in the head with a firearm."
The two men fled but Estrada chased and caught the suspected gunman, identified as Lamont Pride, 27, and put handcuffs on him, the New York Post reported. The other man was still at large.
Estrada suffered a sprained shoulder during the confrontation.
"I want to commend officer Estrada, who had the presence of mind to focus on the man with the gun, and the courage to chase him down and capture him," Kelly said
Figoski was a police officer for 22 years and the father of four children, the New York Daily News reported.
"I'm a father of two myself and having to tell kids of any age what happened to their father or mother is one of the hardest things any mayor has to do," Mayor Michael Bloomberg said.