Police say a 17-year-old walking on Madison Avenue near 112th Street began shooting at a group on the street around 11 p.m.
No one was hit by the bullets.
Three members of an NYPD gang unit saw the incident and began chasing the suspect, identified as Sean Terrell.
The officers caught and arrested him.
A gun was recovered at the scene.
Terrell is charged with attempted murder, criminal use of a firearm, criminal possession of a weapon, reckless endangerment and menacing against a police officer.
Get Eyewitness News Delivered