The officer was walking to work when he was attacked by the two men at the intersection of Broadway and Grove Street just before midnight.
Police say one of the men simulated holding a gun while the other knocked the victim down to the ground with a cane.
The detective opened fire on the muggers, hitting the cane-wielding suspect once in the chest.
Antwain White, 17, was rushed to Woodhull Hospital in traumatic arrest and pronounced dead.
The second attacker fled the scene on foot, but was captured a short time later. Police have not released his name.
The detective was not physically injured, but was taken to Wyckoff Heights Medical Center for treatment of trauma.
He was walking to the subway at the time of the attempted mugging.
Get Eyewitness News Delivered