It happened around 9:05 a.m. on 148th Street and Jamaica Avenue, where police say the gunman was taking aim at a man on Jamaica Avenue when his bullets hit a Q8 bus.
The street was very busy at the time of the shooting, with pedestrians scrambling for safety when the gunfire rang out.
ALSO READ | 2 charged in teacher's stray bullet death among 28 arrested in NYC gang bust
The gunman missed his target, but the bullets that went through the bus window struck two men, ages 20 and 66.
"I was looking from the window, and I saw him open a bag," one witness said. "He fired three shots, and the guy ran the other way."
The victims were struck in their arms and are expected to survive. A bullet hole could be see in the front window of the bus.
The video of the shooting shows the bus pull up and the two men in the right-hand corner on the street scattering away.
Police say the suspect, 43-year-old Melvin Adams, dropped a black backpack and ran from the scene.
The quick-thinking bus driver jumped out of the bus and flagged down a passing NYPD car.
"What I could say is we have a dispute on the street, a stare down between two people," NYPD Chief of Detectives James Essig said. "One of the people who was disputing gets on the bus. The other man pulls a gun, fires it into the bus, striking two innocent people on that bus. An off-duty police officer who was going to work, along with responding patrol officers, observed him leaving after the shooting. They recovered the gun, and he is under arrest."
ALSO READ | Lack of drivers, NYC workers leads to yellow cab shortage during COVID pandemic
Officers were able to quickly apprehend Adams using a Taser. They say they found a gun in the black backpack.
Police said there were "11 rounds still in the magazine in that gun, and there was an additional loaded magazine filled with bullets also recovered inside the bag with the firearm."
"We really skirted the worst case scenario here," interim NYC Transit President Craig Cipriano said. "We know the bus operator took some heroic actions by coming out of the bus and flagged down police."
Adams is charged with attempted murder, assault, criminal possession of a weapon and criminal possession of a loaded firearm.
* More Queens news
* Send us a news tip
* Download the abc7NY app for breaking news alerts
* Follow us on YouTube