An arcing cable on an Upper West Side subway line set off an explosion of flames during the Wednesday afternoon rush hour that sent terrified straphangers stampeding, witnesses and officials said.

“I see a bunch of sparks coming towards the platform, [and] I think the train is coming,” said Bryan Murphy, who was waiting on the southbound 96th Street 1/2/3 platform when the mayhem unfolded around 4:30 p.m. “I smell smoke and hear a loud, rumbling, crunching sound.”

“I see a ball of fire filling the end of the tunnel,” the 29-year-old Bronx teacher told The Post. “People are running and screaming and people were falling down and you had to step over the them.”

“I get caught in a cluster of people right by the stairwell and can’t move forward and I’m thinking that if the wall of flame doesn’t stop moving forward I’m going to die today,” Murphy added in a Facebook post.

Other straphangers took to social media to chronicle the chaos.

“The fire was coming towards the platform,” tweeted @missez_nattie. “As I’m finally able to run out, all I see are shoes, bags, strollers, every single possession possible just scattered on the platform.”

A Twitter photo posted by @MattRonen shows a crush of panicked straphangers piled onto the platform, with the caption “Hope no one was hurt. Emergency responders have arrived.”

Navin Raj, an MTA spokesman, blamed the smoky explosion on an arcing cable.

One person was hospitalized with minor injuries, the FDNY said.

The 2 and 3 train ran locally from 72nd Street to 96th Street while the blaze was investigated, but has since resumed express service.

Raj could not immediately say whether the arcing cable may have been caused by the weather.