A man accused of armed robbery was arrested Thursday afternoon by an officer who chased him onto a CTA L car by prying open a closing door.

Xavier Lyons, 18, was charged with armed robbery after he allegedly showed a replica pellet gun to a 27-year-old woman and demanded her property in the Lake View neighborhood, Chicago police said.

Lyons ran off shortly after 3 p.m. from the 3100 block of North Kenmore and was spotted by an officer at the Belmont Red Line station, police said.

Officer Timothy Kroski saw Lyons, who matched the description of the robbery suspect, and followed him onto a southbound train by pulling open the doors and grabbing hold of him, CPD Cmdr. Marc Buslik said in a press conference Thursday.

The department attributed the swift arrest to the practice deploying of officers to CTA stations immediately after robberies, Buslik said. In this case, the arresting officer was dispatched to the Belmont station after the first report of the robbery, Buslik said.

“From assessments in the past we discovered that robbery offenders would typically use the Red Line to come up to the district and then get on the train and flee,” Buslik said.

“What we saw today is a sergeant and seven police officers who knew where to be and when they should be there,” Buslik said.

The officers recovered a stolen debit card, Buslik said. Lyons was a resident of the South Side Chatham neighborhood.

Lyons was scheduled for a bail hearing Friday at the Leighton Criminal Court Building.