The last 15 minutes of “Captain Phillips” are perhaps the most compelling moments of film this year. They will leave you shivering.

Not that there’s anything shoddy about the previous two hours of the film. This is one of the year’s best movies and it features Tom Hanks’ strongest work in more than a decade. But it’s a live wire, time bomb of a film that, when it finally releases, leaves your nerves scrambled.

Directed by Paul Greengrass with the same sense of immediacy and urgency he brought to “United 93” and given a major boost by the untrained Somali immigrant actor Barkhad Abdi, “Phillips” tells the real-life story of Rich Phillips, the captain of a cargo ship moving along the coast of Africa in 2009.

Phillips and the ship become the 24-hour focus of cable news after four Somali pirates, braving rocky seas in tiny boats, storm aboard the unarmed tanker, brandishing machine guns and demanding millions in ransom.

The English-speaking leader of the pirates is Muse (Abdi), and Greengrass takes care to both show the desperate conditions of the Somali’s lives as well as their limited options. If they don’t come back with big money, some warlord will likely take their lives. So whereas Muse is one scary dude, he’s also desperate. He’s no villain in a vacuum.

When the Somalis come aboard, Phillips orders most of his crew to hide deep in the boat’s bowels, in its engine room. As he is taken prisoner on the bridge — in a particularly tense scene — he basically plays dumb. But when the Somalis threaten to start shooting his officers, he offers to help them search the ship.

Things eventually come to a standoff and Phillips and the Somalis end up at sea in a cramped lifeboat with Muse demanding millions for the captain’s safety.

Greengrass opens on the widest canvas imaginable — the open sea — and then closes in on the large boat before bringing the film down to the claustrophobic confines of the covered lifeboat, and you feel pulled ever closer to the captain’s dangerous circumstance. The captive of four desperate men with machine guns crammed into the space of a mini-van, bobbing around at sea.

Hanks keeps Phillips cool and grounded for as long as possible, from the opening scene where he’s worrying with his wife (Catherine Keener) about what the future holds for their kids (likely one of the modern world’s most common conversations) to his initial negotiations with the pirates. But Rich Phillips is not some superhero; he’s an ordinary man in an extraordinary, horrific situation, and Hanks brings great reality and humanity to the role.

Greengrass also directed the two best Bourne films, and “Captain Phillips,” with its pounding score and choreographed, quick-cut action, is very much a thriller at sea.

But Greengrass, Hanks and Abdi all go beyond the obvious, bringing depth and context to a world that’s messy and brutal and awful. “Captain Phillips” isn’t about being heroic; it’s about surviving.