Hostage situations have inspired so many shallow, primitive genre films that it’s eye-opening to see what an inspired filmmaker can achieve with the material. The spellbinding “Captain Phillips” re-creates the 2009 hijacking of an American-crewed freighter off the shore of Somalia. It’s an efficient, fast-paced survival thriller, a gripping character study of men under stress, and an object lesson in the power of spare, realistic storytelling.

The story is straightforward enough to give the film vast appeal, but packed with the details that elevate a fine script and premise into a riveting experience. Director Paul Greengrass (“United 93,” “The Bourne Ultimatum”), a onetime documentary journalist, uses hand-held cameras, desaturated colors and authentic settings to create a physical world of inarguable authenticity. There’s not an ounce of fat in “Captain Phillips,” no awkward back story to drag. Character emerges not through emotional dialogue, but in action. The conflict, with impoverished gunmen seizing a ship packed with the world’s riches, is the story’s catalyst and its dominant metaphor rolled into one.

Tom Hanks has his best role in a decade as Richard Phillips, commander of the Maersk Alabama. Heavyset and middle-aged, he has spent a long career getting his vessels through rough weather. He’s disciplined, by the book, a little distant from his crew. But when two small skiffs approach on his ship’s radar far from fishing waters, concern flickers in his eyes. When they return despite his evasive maneuvers, bearing AK-47s and grappling hooks, the look deepens to fear.

Once the pirates reappear, every frame is charged with mortal danger. The physical contrast between the bone-thin Africans and the fleshy Americans says everything we need to know about Third World-First World tensions.

The film isn’t an exercise in liberal hand-wringing. The story’s sympathy is squarely with the hostages, yet it doesn’t provide easy answers. The film notes that these village fishermen turned to crime after high-tech harvesting armadas depleted their fish stocks. When Phillips protests there must be other paths than fishing or piracy, one of the Somalis replies, “Maybe in America.”

Humanizing the Somali robbers doesn’t justify their actions. It amps up the sense of menace by portraying the raiders — all played by first-time actors from Minneapolis — as actual people. Najee (Faysal Ahmed) is high-strung, hot-tempered and trigger-happy. Bilal (Barkhad Abdirahman), the youngest, clearly wishes he were anywhere else. Muse (Barkhad Abdi), their leader, is ruthless but not malicious. It’s his job to bring a fortune back to his bosses, and if some Americans have to die to motivate the insurance companies, that’s unfortunate.

Hanks is on familiar turf here, playing a character as smart and moral as his FBI agent from “Catch Me If You Can,” but as wary and worried as his Army officer in “Saving Private Ryan.” Placing himself in harm’s way, he alerts his men hiding below decks of the pirate crew’s movements, guiding them through a life-and-death game of hide and seek.

The Somali-Americans, all stunningly good actors, have arguably the tougher job. They turn our natural animosity toward gun-waving criminals to begrudging understanding. Like the reality-based bank heist classic “Dog Day Afternoon,” we know how the story ends, and it’s still painful to see it.