Both officers are in critical but stable condition.
The shooting occurred around 10:30 p.m. Monday near East 184th Street in the Tremont section of the Bronx.
The officers were coming off their shift when they and three other plainclothes officers responded to a report of a grocery store robbery.
Police were trying to determine whether a man who later walked into a hospital with a gunshot wound to his back was connected to the case.
The shooting came about two weeks after two officers were fatally shot while sitting in their patrol car in Brooklyn.
Mayor Bill de Blasio said the officers went “above and beyond the call to protect their fellow New Yorkers.”
2014 Saw Fewest Murders In Recorded City History; Lowest Robberies, Burglaries In 10 years http://t.co/ldQha1FPyQ pic.twitter.com/yj4k4pNyI3
— NYPD NEWS (@NYPDnews) January 5, 2015