Jack Dylan Grazer and Zachary Levi in 'Shazam!'Warner Bros.

Many a superhero origin story—and heaven knows that cinemas have been flooded with them in the past decade—has an extended early sequence in which the protagonist gets to fool around with his or her newly acquired powers. Think of Spider-Man before he learns that with great power comes great responsibility, when he’s using his wall-crawling abilities to win wrestling matches and swing around the city with impunity. Shazam!, the loudly titled new comic-book adventure from David F. Sandberg, is a feature-length adaptation of that freewheeling phase: Young Billy Batson (played by Asher Angel) is given great power, and with it, he has a lot of fun.

Shazam! is based on a 1940s Whiz Comics title, which centers on a caped, many-muscled hero called Captain Marvel (no, not that one) who dresses in red and flies like a speeding bullet. Subsumed into the world of DC Comics in the 1970s after a long lawsuit over the Whiz hero’s similarity to DC’s Superman, this odd also-ran can’t even use his original name now that it’s been claimed by the Marvel Cinematic Universe. Still, Sandberg and the screenwriter Henry Gayden lean into the quirkiness of the property they’re adapting and let it dominate the story, making a fairly typical tale of derring-do feel somehow intimate, character-driven, and inventively funny.

Given the glut of spandex-wearing champions being churned out every month, theatergoers would be well within their rights to claim superhero fatigue and skip Shazam! But the film is hyperaware of the many storytelling tropes it can remix, razz, or flat-out ignore, precisely because audiences are so used to them. While Shazam! is technically part of the extended DC Comics Universe that produced duds such as Batman v Superman and Justice League (as well as the far more winning Wonder Woman and Aquaman), those films belong to a different, self-serious endeavor, with heroes who stand for truth and honor, and pitiless villains who need to be driven back into other dimensions.

In Shazam!, our hero, Billy, is a teenage boy whose biggest demons are internal; he was abandoned as a child and has a strong rebellious streak as a result. After one of his frequent attempts to run away in search of his mother, Billy is placed in a new foster home, run by the kindly Victor (Cooper Andrews) and Rosa Vasquez (Marta Milans), where he rooms with a wisecracking paraplegic boy named Freddy Freeman (Jack Dylan Grazer). After an act of kindness—defending Freddy from school bullies—Billy is chosen by a decrepit old wizard (Djimon Hounsou) to gain the magic powers of Shazam. What magic powers are those? Well, super strength, for sure, along with invulnerability; lightning bolts; flight (though Billy isn’t too good at that); and, most important, the ability to turn into a grown man (Zachary Levi) anytime he yells—all together now—the word Shazam!

What follows is a large-hearted cross between Big and Man of Steel that spends most of its running time reveling in the juvenile joy that any teenager who could turn into an unkillable Übermensch would feel. As Shazam, Levi possesses the same kind of ridiculously proportioned body that his costumed contemporaries do, but he’s also a skilled comic actor who can sell Billy’s utter lack of readiness to become a broad-shouldered adult who might have to save the world. Instead, Billy and Freddy buy beer, make YouTube mashups of Shazam’s super strength, and use his lightning powers to rapidly charge the phones of random passersby. Today’s bleak society might be in need of idealistic role models, but Shazam! celebrates the very human selfishness that comes with Billy’s cosmic windfall.

If it were just a loosey-goosey genre spoof, Shazam! would be a successful but forgettable confection. But the film seamlessly shifts into a more emotional gear as it barrels toward its final act, where some life lessons must be learned and a glowing-eyed villain (Mark Strong) has to be confronted. It ends on a twist that surprised me in the best way, opening up Billy’s heroic arc in intriguing directions and getting me choked up out of nowhere. This is the rare comic-book movie that actually seems geared toward families, mixing adolescent humor with sincere sweetness that doesn’t cloy.

Many a 21st-century project, be it Netflix’s Stranger Things or J. J. Abrams’s Super 8, is indebted to the 1980s output of Steven Spielberg and his company Amblin Entertainment, which made classics such as Gremlins and Back to the Future. Fun kids’ fare, in other words, with just the right amount of edge. But those imitations often trend too dark. Shazam! has none of the slavish ’80s references or obvious needle drops, but in tone and style, it’s right out of the Spielberg playbook of rollicking genre adventures that don’t have to line up with carefully plotted franchises. Shazam! is a throwback in all the right ways: a superhero tale for a simpler blockbuster era, one that is well worthy of viewers’ nostalgia.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.