[This story contains major spoilers for season three of Netflix's Stranger Things.]

In Stranger Things season two, the Duffer Brothers broke away from the main action of Hawkins, Ind., for an entire episode set in Chicago, centered on Eleven (Millie Bobby Brown) meeting another like-powered individual. It was not a widely praised choice. For season three, no such deviations are made from the main narrative — at least not for an entire episode. But for a two-minute stretch in the action-packed finale, "The Battle of Starcourt" becomes something entirely different: a musical.

The moment arrives as Hopper (David Harbour) and Joyce (Winona Ryder) are desperately trying to crack a code to access keys inside a safe, with which they stand a chance at defeating the monstrous Mind Flayer. The only way they can get the code: Dustin (Gaten Matarazzo) must call his Utah-based girlfriend Suzie,(Gabriella Pizzolo), a secret math wiz — and, up until that moment, a person whose very existence was far from certain in the minds of Dustin's peers. She knows the answer to a math equation, which will unlock the safe's code, but will only offer up the information if her beloved "Dusty-bun" regales her with a song: "The NeverEnding Story," Limahl's power ballad theme song to the 1984 fantasy epic of the same name, recorded for the show's purposes by series music editor David Klotz.

The result: a full-fledged music number, in which Matarazzo's Dustin and Pizzolo's Suzie sing the song at each other over the radio from across state lines — all while the Mind Flayer runs rampant across Hawkins, and all while Hopper and Joyce impatiently await an answer to the code. Some lyrics, for those who require a refresher:

Turn around

Look at what you see

In her face

The mirror of your dreams

Make believe I'm everywhere

Given in the light

Written on the pages

Is the answer to a never ending story

Reach the stars

Fly a fantasy

Dream a dream

And what you see will be

Rhymes that keep their secrets

Will unfold behind the clouds

And there upon a rainbow

Is the answer to a never ending story

The moment comes as a jarring surprise in the context of the episode, but it should come as no surprise given the musical theater backgrounds of the young Stranger Things cast. New Jersey born Matarazzo appeared on Broadway with key roles in Les Misérables and Priscilla, Queen of the Desert, while Pizzolo made her Broadway debut in 2013 in the title role of Matilda the Musical. Fellow co-stars Caleb McLaughlin and Sadie Sink, who later sing the song to mock Dustin, are also Broadway veterans, having starred in The Lion King and Annie, respectively. The sequence exists at least in strong part to nod at the young actors' singing abilities, but according to Matarazzo, it wasn't something heavily discussed until much closer to production.

"I just read it in the script," he tells The Hollywood Reporter of how he first discovered the NeverEnding Story sequence. "I didn't know the song before; I wasn't familiar with it."

Though their characters were separated across state lines in the context of the story, Matarazzo and Pizzolo weren't quite so far from each other during production. "She was on set with us, which was great," says Matarazzo. "We ended up harmonizing together, which I didn't expect. It just took like a day to learn all the words. Definitely by the end of the day it was stuck in everyone's heads."

Maya Hawke, who plays ice-cream scooper Robin, falls under Matarazzo's definition of "everyone," according to Stranger Things composers Kyle Dixon and Michael Stein. The duo were not responsible for the song's inclusion in the season, and first found out about it while on set with Hawke.

"I was on set and I heard [her] going around the warehouse singing 'NeverEnding Story' and I had no idea that that was a part of the narrative of the show," says Stein. "And I was like why is she singing 'NeverEnding Story?' Later I found out."

"The NeverEnding Story" marks a point of intersection between the myriad movies and songs referenced through Stranger Things season three. Additional cinematic inspirations include Day of the Dead (the party watches the movie, and the George Romero zombie film's plot alludes to the subterranean Russian base beneath the mall), Back to the Future (again featured on screen within Stranger Things, and a potential tease at future time-travel storylines within the Netflix drama) and The Terminator, with Andrey Ivchenko as Grigori stalking the season as a stone-cold, single-minded killer. Musically, prominent songs featured in season three include Corey Hart's "Never Surrender," Foreigner's "Hot Blooded" and "Cold as Ice," Madonna's "Material Girl" and Weird Al's "My Bologna." The list goes on — not quite "never ending," but close enough.

Liz Shannon Miller contributed reporting to this story.

Follow THR.com/StrangerThings for more coverage.