The Scottish actress Kelly Macdonald is a versatile talent who has handled a variety of roles over the last 20-plus years, but she’s best known for roles as the girlfriend or the wife.

Macdonald made her film debut in “Trainspotting” as the schoolgirl who meets Ewan McGregor’s Renton in a club and hooks up with him. She played Margaret Thompson, wife of Steve Buscemi’s Nucky, for five seasons on HBO’s “Boardwalk Empire. She was spectacularly good as Josh Brolin’s wife in “No Country For Old Men.

In the understated and quietly moving “Puzzle,” Macdonald is once again playing a wife and mother — and a subservient one at that, at least when we first meet her — but it’s the lead role in the story, and how wonderful it is to see this fine actress carry a film and carry it so beautifully.

Macdonald plays Agnes, a stay-at-home mother in Bridgeport, Connecticut, who never stops tending to the needs of her old-school husband Louie (David Denman), who owns a garage, and their teenage sons Gabe (Austin Abrams) and Ziggy (Bubb Weiler), who are both struggling to map out their futures.

Even at her own birthday party, Agnes is almost an afterthought. She busies herself serving the guests and has to bring out her cake from the kitchen. (Don’t lift a finger to help, Louie. Why should today be any different from every other day?)

It appears as if Agnes has received all of two gifts for her birthday: an iPhone, which doesn’t do anything for her, and a 1,000-piece jigsaw puzzle.

THAT gets her attention, for reasons Agnes probably can’t even explain. She pours out the pieces and gets to puzzling — and discovers she’s something of a savant, with a natural ability to see the big picture, so to speak, and piece it together with astonishing clarity and speed.

Agnes learns of a puzzle store in Manhattan (apparently she’s not the Amazon Prime type) and takes the train to the city for the first time in years. She’s floored by the price of a train ticket, the rapidly mounting fare in her cab, the fast pace of the city. It’s as if she’s from another time period.

At the specialty store, Agnes sees an ad from someone looking for a puzzler partner for an upcoming tournament. Wouldn’t you know it, that someone turns out to be the handsome, wealthy, brilliant and recently separated Robert (Irrfan Khan). Robert is dazzled by Agnes’ puzzling skills and drawn to her warmth and strength; Agnes feels alive in the presence of someone who is actually interested in what she has to say.

RELATED: ‘Puzzle’ star Irrfan Khan finds new perspective on life amid cancer treatment

“Puzzle” is a remake of “Rompecabezas,” a 2010 Argentine film by Natalia Smirnoff. Director Marc Turtletaub deftly builds the dramatic tension as Agnes tries to maintain a double life of sorts (for a long time, her husband and children know nothing about her interest in puzzling, let alone her puzzling partner).

The screenplay by Oren Moverman and Polly Mann allows room for exploration of Agnes’ relationships with her two sons, and how they view her. (Agnes happens upon Gabe’s college application essay, which begins: “My mother doesn’t know anything about the world outside of her house, her church, her traditions and our family.”)

MORE FROM RICHARD ROEPER

‘Mission: Impossible — Fallout’ lifts Tom Cruise franchise to dizzying heights
Weak CIA spoof ‘The Spy Who Dumped Me’ runs counter to intelligence

And of course there’s Agnes’ marriage to Louie. The guy is gruff and selfish, and has an almost childlike dependence on Agnes. (He can’t believe it when she goes shopping and doesn’t bring home that certain type of cheese he likes.) But Louie isn’t a bad guy, and he’s dearly in love with Agnes. (As Roy on “The Office,” Denman played a similar, albeit more comically constructed, character.)

In a frothy rom-com, it would be a no-brainer for Agnes to ditch her bonehead husband, tell her nearly grown sons to get it together and set out for a new life with the dashing Robert. But in the grounded, real-world setting of “Puzzle,” Agnes is a devout Catholic, and she does love her husband, and she wants to see her boys reach their potential.

Putting together a puzzle is easy for Agnes. Fitting together all the pieces of a life that has unexpectedly grown more complicated and more challenging — and more fulfilling — is going to be a challenge, no matter which path she chooses.

This is Agnes’ story, and this is Kelly Macdonald’s movie.

‘Puzzle’

★★★

Sony Pictures Classics presents a film directed by Marc Turtletaub and written by Oren Moverman and Polly Mann, based on the film “Rompecabezas” by Natalia Smirnoff. Rated R (for language). Running time: 102 minutes. Opens Friday at local theaters.