Michael MacCauley, an Irish-American NYPD member turned insurance agent, has a wife and teenaged son. He goes through the same routine train commute to work and back every day, taking the Hudson Line from Tarrytown to Grand Central Terminal, often interacting with the same other commuters. His daily routine is interrupted when he is abruptly laid off from his job due to budget cuts after a decade at the same company, leading him to wonder how he will pay his mortgage or afford his son’s college tuition. Choosing not to immediately reveal his dismissal to his family, he instead confides in Murphy, his ex-partner on the force, while he and Murphy’s unit are at a bar.

On the train home, Michael meets a mysterious woman named Joanna, who makes small talk with him. Joanna describes herself as an academic who studies human behavior and tells him there are sixteen distinct types of personalities. She proposes a hypothetical situation to Michael, asking him to do one little thing for which he is uniquely skilled and results of which would have consequences that he would know nothing about, but would affect one of the passengers on the train. Joanna’s one little thing that she wants Michael to do is locate “Prynne,” the alias of an unknown passenger, who she says doesn’t belong and has something stolen. Joanna proceeds to tell him that he will find $25,000 in the bathroom and will be paid another $75,000 when the job is done. Michael starts to question whether this is real or hypothetical, and Joanna, before she gets off the train, alludes to him being a former cop. Out of curiosity, Michael searches the bathroom and finds an envelope with $25,000.

Michael attempts to leave the train but is stopped by another mysterious young woman who hands him an envelope containing Michael’s wife’s wedding ring, and tells him it’s a warning. Michael attempts to call his wife but with no response. He then discreetly approaches a familiar fellow commuter, Walt, and writes a note on his newspaper asking him to contact the police. Michael leaves a voicemail describing the situation to Murphy, and then receives a call from Joanna, threatening him and his family. She tells him that the train is rigged with hidden cameras, and to look outside, where he sees Walt being deliberately pushed in front of a moving bus and killed. Joanna then points him to a GPS tracker in his jacket and orders him to plant it on Prynne.

Michael gives a fake report of suspicious behavior to a conductor, who announces he plans to search a woman’s bag. A man immediately leaves the car and Michael follows him, at which point he attacks Michael. They fight and Michael plants the GPS tracker on him. Murphy calls back and informs him that Prynne is a key witness in a supposed suicide case of a man at the city planner’s office, Enrique Mendez, leading Michael to realize that Prynne will be killed and that Michael is being set up.

In a deserted carriage, Michael discovers the body of the man he planted the GPS tracker on and a badge revealing he was an FBI agent. Joanna then contacts him, chastising him for marking the wrong person and warns him that another passenger has reported his suspicious activities on the train to police, who stop the train to investigate. Michael manages to evade detection by hiding with the corpse under the carriage, but in the process accidentally tears his bag and loses the $25,000 cash. Sabotaging the air conditioning in the train except for the last car, Michael forces all the remaining passengers into the last carriage. He realizes another passenger, a Jazz musician named Oliver, killed the FBI agent. Oliver reveals that he also received the same deal for $100,000, but with orders to assassinate Prynne, after Michael has identified him/her. After a brutal fight, Michael throws the hitman out of the train window, killing him. The real “Prynne” is revealed to be a young girl named Sofia, who is holding incriminating information on powerful people and was to go into witness protection at the final stop of the train. Michael asks Sofia why she did not go to the police. She reveals that it was the police who killed Enrique, who was Sofia’s cousin.

Joanna calls Michael and tries to force him to kill Sofia for the sake of his family, but Michael refuses. Joanna activates the fail-safe plan by detonating rigged explosives on the brakes, to derail the train in order to kill everyone aboard. Michael manages to save all of the passengers by unhooking the final carriage from the rest of the train right before a curve, but a conductor, Sam, dies assisting him. Michael instructs the passengers to block visibility into the car by plastering wet newspapers on all the windows, before a massive police force arrives at the scene.

Operating under the assumption that Michael is holding the train hostage, authorities send Murphy to negotiate with him. However Murphy unknowingly reveals himself as the rogue cop who killed Enrique when he uses a phrase about “being noble” – the same type of language Sofia heard from one of the cops that killed Enrique. Michael and Murphy engage in a fight, during which Michael removes Murphy’s electronic ID tag, which identifies him as a “friendly” to the snipers outside using thermal vision. After a violent fight, the snipers, mistaking Murphy for Michael, shoot and kill Murphy.

Outside the train, the FBI meets Sofia, who proceeds to tell them what she knows. Michael is hailed as a hero and exonerated by the other passengers while the FBI rescues his family. His former captain admits that Murphy and a few others had been under investigation for some time and offers Michael his job back. Michael rummages in his coat pocket and reveals that he kept the hard drive Sofia gave him containing the incriminating evidence.

Some time later, Joanna is on a train back from Chicago. Michael approaches her (presumably having found her through the information on the hard drive) and confronts Joanna about her actions before he shows her his police detective badge, implying that he is ready to arrest her.