Four years ago Steven Soderbergh announced that he was retiring from feature filmmaking; it was depressing news. Now, after working mostly in television since then, he returns with a new movie, and it’s a dandy. To quote the adjective from its title, we’re lucky to have him back.

“Logan Lucky” will be compared to Soderbergh’s “Ocean’s” pictures, and that’s apt, as far as it goes; it’s about a complicated heist. But perhaps a better description would be that it’s a Southern-fried, larky take on Stanley Kubrick’s great 1956 racetrack robbery flick “The Killing.” Based on a screenplay credited to the otherwise unknown Rebecca Blunt—who may or may not be a pseudonym for Soderbergh (who, after all, shoots many of his movies himself under the nom de camera Peter Andrews, as here), it spins an improbable but agreeable tale of a group of West Virginians at the lower end of the socio-economic spectrum who pull off an elaborate theft at the Charlotte Motor Speedway during a big NASCAR race.

The organizer of the heist is Jimmy Logan (Channing Tatum), a divorced guy whose main joy in life is the time he spends with his daughter Sadie (Farrah Mackenzie). She lives with her mother Bobbie Jo (Katie Holmes) and her new husband Moody Chapman (David Denman), who runs a car dealership, and his two sons. Sadie is preparing intensely for a talent show in which she intends performing, in glitzy style, a Rihanna song, but she’s always ready for an outing with daddy.

Jimmy, however, is not doing so well. He’s been bounced from his job handling a bulldozer at a repair job at the speedway, simply because somebody spied him limping from an old football injury—which could cause insurance problems. Before being fired, though, he noticed that all the cash taken in during a race was still being transported to the underground vault via a pneumatic tube system that can be easily hacked—especially since, while repairs are ongoing, the usual alarm has been turned off.

Jimmy enlists his brother Clyde (Adam Driver), a dour bartender who lost his lower left arm in Iraq and now uses a prothesis, in a scheme to pull off the job, despite the fact that Clyde is convinced that they both suffer from a family curse that will doom the scheme. Their sister Mellie (Riley Keough), a spitfire hairdresser, also becomes involved. But for the plan to work, they will need the services of the local explosives guru Joe Bang (Daniel Craig). Unfortunately Joe is incarcerated, and so the robbery has to be preceded by a jailbreak—one that, however, will be engineered so that his absence won’t be noted. That will necessitate orchestrating not only Clyde’s getting jailed with him, but a riot that the warden (Dwight Yoakum) won’t report to preserve his sterling record.

That’s only a preliminary cast of characters. Others include Joe’s doofus brothers Fish and Sam (Jack Quaid and Brian Gleeson), who have to be convinced that the heist is a moral one before agreeing to participate; Sylvia Harrison (Katherine Waterston), a worker in a health-care trailer that criss-crosses the impoverished locality; Max Chilblain (Seth MacFarlane), an odious English NASCAR owner who aims to win the race; Dayton White (Sebastian Stan), Max’s top driver; and Sarah Grayson (Hilary Swank), a brusquely by-the-book FBI agent. They all play roles, some more peripheral than others, in the increasingly labyrinthine action, where things seem to go off the rails as often as they remain on line. Toward the close the movie adds a major twist that appears to throw everything askew, and then another that sets affairs right again, before appending a sentimental coda followed by yet another turn that promises to take the story in an entirely new direction—perhaps in a sequel.

That description might make “Logan Lucky” sound confusing or precious, but in fact the script is so carefully laid out, Soderbergh’s direction is so secure, and his editing (under another pseudonym, Mary Ann Bernard) so smooth, that it all hangs together like a fine clockwork mechanism, and the shifts in tone are pleasant rather than jarring. Even the different qualities of characterization—from Tatum’s regular-guy seriousness, Waterston’s earnestness and Driver’s moodiness through Keough’s rambunctiousness and Swank’s brittle officiousness to the zanier turns by MacFarlane, Quaid, Gleeson and especially Craig, whose send-up of the tough-guy archetype marks a great change of pace for the actor. While a few of the others—like Holmes—are underused, that’s probably inevitable when such a bevy of characters are introduced. The other tech credits, including Howard Cummings’ production design and Ellen Mirojnick’s costumes, are all fine for a modestly budgeted effort, and David Holmes contributes a score that doesn’t becoming overbearing, like those of so many comedies.

Last year there was another “hillbilly heist” movie, “Masterminds,” with Zach Galifianakis. It was terrible. Soderbergh proves that it’s not the idea that was bad, but the execution. “Logan Lucky” is, quite simply, one of the most sheerly enjoyable movies of the year.