Dramatic video shows the moment a man pulled a gun and opened fire, striking two teens this week in broad daylight in Harlem.

In the 17-second cellphone video — which was taken by a New York state parole officer sitting in the passenger seat of a parked car and obtained by The Post — the red-shorts-wearing gunman can be seen running toward two boys before two shots ring out.

The shooting occurred on Park Avenue near East 112th Street around 4 p.m. Monday, law enforcement sources said.

“He’s got a gun, he’s got a gun,” one of the two parole officers seated in the car says as 23-year-old shooter Mauricio Rouse emerges from a nearby park and runs after his victims, the clip shows.

“Holy s–t!” the parole officer shouts after the shots are fired.

A 17-year-old boy was struck in the leg and a 15-year-old boy was shot in the back, sources said. Both victims suffered non-life-threatening injuries.

Rouse, who lives near the scene of the crime, was arrested shortly after the shooting.

He was charged with attempted murder in the second degree, assault causing serious injury and criminal possession of a weapon in the second degree, police said.

Rouse had two prior arrests on his record for assault and marijuana possession, according to sources.

Additional reporting by Stephanie Pagones