Of all the frenzied races in Steven Spielberg’s “Ready Player One,” the closest one pits the director’s mastery against the material’s banality. By a whisker, Spielberg wins it.

If you’re a fan of the 2011 Ernest Cline best-seller, you wouldn’t use “banality,” but you’d have to concede “familiarity” as an acceptable substitute. We’re back in the realm of Young Adult dystopia, in this case (as revised by screenwriter Zak Penn, working with co-adapter Cline) the miserably overcrowded year 2045 in Columbus, Ohio. There, our Young Hero, Wade, played by Tye Sheridan, lives a life the way millions of his fellow citizens are living it. They’re hooked on their virtual-reality devices, and wired for hours and hours at a stretch into the multistrand worlds of the OASIS (Ontologically Anthropocentric Sensory Immersive Simulation), created by the late tech genius played, thank God, by Mark Rylance.

The story is “Charlie and the Chocolate Factory,” digitized. The sweetly mad inventor has hidden clues to three keys inside the OASIS, and whoever secures all three becomes heir to a massive fortune. Much of “Ready Player One,” and the artistic reason for Spielberg’s involvement, concerns the ever-shifting parameters and rules and environments within the OASIS. For an hour, “Ready Player One” is terrific fun with a necessary ominous edge. At its heart is a lovelorn teen boy looking for a real connection. Wade’s gaming avatar, a sleek, blonde, tattooed, boy-band-looking dude named Parzival, longs to know the supercool Art3mis in the real world, where she is plain ol’ supercool Samantha, played by Olivia Cooke.

If the whole of “Ready Player One” were as fluid and exciting as the first action showcase, we’d have a classic. Driving the DeLorean from “Back to the Future,” Wade/Parzival learns the secret to winning the dizzying championship auto race. From there it’s on to the next world, the next race for the next key. The forces of corporate evil conspire against Wade and, eventually, his OASIS posse. Ben Mendelsohn portrays the sniveling face of adversity, and he makes for a surprisingly ineffectual antagonist. Or maybe I’m at the point in my life where I want Rylance to play every available supporting role, not just one or two.

The movie runs 140 minutes, which feels overgenerous for the amount and the quality of the narrative at hand. Spielberg juices it, flinging the audience between virtual worlds, and between virtual and real ones. The visual referencing is happily relentless. The holy hand grenade from “Monty Python and the Holy Grail” flies by for a cameo; so does King Kong and “The Breakfast Club” and Chucky from “Child’s Play” and famous emblems of Spielberg’s own movies.

For a longer section, “Ready Player One” enters a sly re-creation of “The Shining.” There, Wade’s cohort Aech (don’t want to give away the performer; it’s a bit of a spoiler) runs afoul of the blood-gushing elevator and the twins and the beautiful woman in the tub who turns out to be a decaying crone, this time for laughs.

So it goes. In the later stages of the story, we’re stuck with routine complications and challenges posed by the Mendelsohn character and his ferocious aide played by the infinitely more charismatic Hannah John-Kamen. Spielberg’s control of pacing, rhythm, action dynamics and tonal juggling is so astute that the story of Wade never quite gets lost in all the fly-by jokes and references. Sheridan’s highly skillful, as is Cooke.

But there’s a big difference between a movie content to surf a tsunami of nostalgia, and science fiction sturdy enough to invent tomorrow’s nostalgia, today. Lest we forget, “E.T.,” “Close Encounters of the Third Kind,” “A.I.” and “Minority Report,” to name four of the director’s achievements, sampled all sorts of established literary and screen classics. “Ready Player One” is a different and more disposable diversion. It’s like a visualization, however immersive and impressive, of movie trivia night down at the local bar.

But as I say: By a whisker, Spielberg wins the race against his own material.