Trick or treat: Chris Hemsworth plays dress-up in “Thor: Ragnarok.”

Like most of the better Marvel efforts, Thor: Ragnarok feels like the work of a unique sensibility instead of a huddle of brand managers. While the studio’s films demonstrated plenty of comic flair right from the start of its shared-universe experiment, with 2008’s Iron Man, recent efforts have veered too far into bland, jokey listlessness; frivolity has trumped lightheartedness, pandering has replaced irreverence. But in Ragnarok, directed by the Kiwi filmmaker and actor Taika Waititi, the gags are weird enough, and land frequently enough, that it all seems to be coming from someplace — and someone — real.

In its broad strokes, however, the setup is not so different from the standard-issue comic book movie. Thor (Chris Hemsworth), god of thunder and key member of the Avengers, discovers that his heretofore-unknown-to-him older sister Hela (Cate Blanchett), the god of death, has been freed from her cosmic prison and is coming to claim her throne in their home world of Asgard. But his first attempt to stop her fails: He’s deprived of his all-powerful hammer, and winds up imprisoned on Sakaar, a distant planet where he’s forced into gladiatorial combat against his old friend the Hulk (Mark Ruffalo), who doesn’t seem to recognize him. As Hela subjugates the people of Asgard and grows more powerful, our hero has to find a way back. It’s basically The Dark Knight Rises, with a bit of Gladiator thrown in.

But look to the particulars, and you’ll find joy. Sakaar is ruled over by the Grandmaster, played by Jeff Goldblum with a perfect mixture of flamboyant theatricality and aw-shucks narcissism. Thor and Hulk’s captor/manager is an alcoholic Valkyrie turned scavenger (Tessa Thompson), and the back and forth among the three of them is fast and witty. Deprived of his hammer, the thunder god is repeatedly surprised to discover that he’s a lot less strong than he imagines himself to be, allowing the film to take advantage of Hemsworth’s gift for comedy. Waititi, an inspired comic director, understands how to stage physical humor, and he knows that even verbal gags are improved by savvy framing and editing. This attention to technique distinguishes Ragnarok from the amiable snoozers that Marvel has been churning out of late, like the most recent Spider-Man and Guardians of the Galaxy entries.

A kind of low-level trickster god of indie cinema himself, Waititi lets his film go a little crazy: He’s outfitted it with garish colors and costumes and set designs, some not-entirely-perfect special effects, and a synthesized Mark Mothersbaugh score that sounds like it was lifted from an early period Jean-Claude Van Damme flick. There’s a constant sense of play and dress-up, with characters constantly changing in and out of fresh outfits — sometimes to get out of different scrapes, sometimes to hide, and sometimes for no real reason at all.

This could get tedious, if the film didn’t feel like it was ambling toward an idea with all this clever cosplay. Early on, Thor arrives at Asgard to find someone staging an impromptu play based on the supposed final moments between him and his brother (and occasional archvillain) Loki from a past battle. In a trio of goofy cameos, Matt Damon plays the fake Loki, Chris’s brother Luke Hemsworth plays the fake Thor, and Sam Neill plays their fake father, Odin; meanwhile, the real Odin (Anthony Hopkins) watches the players from nearby, only it turns out he’s not Odin at all, but the real Loki (Tom Hiddleston) in disguise, attempting to rewrite his own sordid history and present himself as a hero. (Got all that?) Later, Waititi depicts the Grandmaster’s world of Sakaar as one where the flashy strongman constantly keeps his subjects entertained and docile with gaudy spectacle and competitive combat.

It makes an interesting contrast, as the film intercuts between the grim, shadowy enslavement of the people of Asgard and the decadent, brightly lit, there’s-a-party-going-on enslavement of the people of Sakaar. (As if to underline this duality, Thor has to help spark concurrent revolutions in both worlds.) So that, even as the picture piles on the retro stylizations and the goofy one-liners, the undercurrent of oppression is inescapable. In its own weird little way, Thor: Ragnarok manages to poke fun at the constant churn of myth and entertainment of which the movie itself is a part. It’s a candy-colored cage of delights, but it is a cage nevertheless — and it doesn’t hide that fact.

Thor: Ragnarok

Directed by Taika Waititi

Walt Disney Pictures

Opens November 3