MLB's Field of Dreams game ended in Hollywood fashion on Thursday night. 

Chicago White Sox shortstop Tim Anderson crushed a two-run homer off New York Yankees pitcher Zack Britton in the bottom of the ninth inning to give the White Sox a thrilling 9-8 walk-off win. 

"A #walkoff into the corn at #MLBatFieldofDreams. Couldn't write a better script," the MLB tweeted. 

CHISOX, YANKS AWED AT FIELD OF DREAMS, MLB PROMISES REPEAT

The Yankees had taken an 8-7 lead before the Hollywood ending, which saw Anderson circle the bases as fireworks exploded. 

"The game's never over 'til it's over," he said after the game, according to The Athletic. "I knew what I was looking for and I didn't miss. Let's go home."

Chicago White Sox shortstop Tim Anderson (7) celebrates his walk-off home run against the New York Yankees in the ninth inning during a baseball game, Thursday, Aug. 12, 2021 in Dyersville, Iowa. (AP Photo/Charlie Neibergall) (AP Photo/Charlie Neibergall)

The city of Dyersville, Iowa, hosted the "Field of Dreams" game, which also served as the first-ever regular-season MLB game played on Iowa soil.

"Field of Dreams," the 1989 Kevin Costner flick, was filmed in Dyersville. In the iconic movie, Costner plays Ray Kinsella, an Iowa farmer who hears a voice telling him, "If you build it, he will come." Kinsella then proceeds to builds a baseball diamond on his land.

The well-kept movie set was steps away from the stadium built to hold 8,000 fans for Thursday night, and designed to resemble Chicago's old Comiskey Park. 

Costner came back for the game, stealing the scene with a slow, ponderous stroll into the outfield his character Ray Kinsella often took in the film before stopping to watch the real White Sox and Yankees emerge from the corn for pregame introductions.

Clutching a ball in his hand, while the original symphonic score from the movie played over the loudspeakers, Costner stepped up to a microphone and told the crowd, "It's perfect."

Actor Kevin Costner walks to the stands before a baseball game between the New York Yankees and Chicago White Sox, Thursday, Aug. 12, 2021 in Dyersville, Iowa. (AP Photo/Charlie Neibergall)

There were rows upon rows of corn between the two outfields, in fact. Yes, it's the same spot where Shoeless Joe Jackson and his pals appeared — and disappeared — throughout the Academy Award-nominated film about fathers, children, culture, self-discovery, ghosts, and, oh, yeah, baseball.

"As a kid you dream of the chance to play Major League Baseball and you watch certain movies or heroes in comic books and fairytales, and getting a chance to actually be at the Field of Dreams and play a game here and have family and friends here and getting a chance to represent the Yankees here, never in my life did I think I'd ever experience this," Yankees star Aaron Judge said.

KEVIN COSTNER RETURNS TO ‘FIELD OF DREAMS’ LOCATION AHEAD OF MLB GAME BETWEEN YANKEES, WHITE SOX

Major leaguers can be particular about the details when they're on a road trip, desiring to maximize comfort and minimize intrusion for optimal performance on the field, but nobody minded any of the logistical hurdles of playing this game a four-hour drive from Chicago and about a half-hour ride from the airport in Dubuque where both teams flew in.

White Sox closer Liam Hendriks was all smiles as he recounted his exploration of the white farmhouse where the Kinsella family lives in the movie that's been well-kept as a tourist attraction.

Both teams had their fill of movie reenactment moments during pregame photo ops on the original field, before retreating into the corn and returning to the regulation stadium to prepare for the game. The players were politely warned not to scrape their faces on the stalks and not to try to enter the maze — one of the fan attractions added to the site for the event — to avoid getting lost.

Chicago White Sox first baseman Andrew Vaughn walks through a cornfield before a baseball game against the New York Yankees, Thursday, Aug. 12, 2021, in Dyersville, Iowa. (AP Photo/Charlie Neibergall)

"Anyone who follows me on Instagram is going to be very sick of corn," said Hendriks, whose phone storage had filled up after all the photos and videos he recorded.

Judge was born three years after "Field of Dreams" was released, but his father introduced him to the movie when he was a kid and he quickly became a big fan. He noted that some of his younger teammates had not yet seen the film.

"I think one of these nights we’re going to sit down and I’ll have a DVD for ’em, ready to go," Judge said with a wide smile.

The film, naturally, remains a strong source of local pride, and Iowa residents were given purchasing priority when the limited amount of public tickets went on sale. The "Field of Dreams Ghost Players," many of whom were extras in the film, gathered on the movie field in the afternoon in their 1919-style uniforms in honor of Jackson's "Black Sox" team that plays a key part in the plot.

Chicago White Sox pitcher Lance Lynn warms up in the outfield before a baseball game against the New York Yankees, Thursday, Aug. 12, 2021 in Dyersville, Iowa. (AP Photo/Charlie Neibergall)

"It’s given us a real identity. When you think of Dyersville, it’s "Field of Dreams," and all the publicity we’ve been getting lately has just been tremendous for the town and the area," said Jude Milbert, one of the Ghost Players who developed a Globetrotters-style troupe after their involvement in the film by putting on youth clinics, doing comedy routines and traveling around the world as ambassadors of the game. They're all former college or semipro players who live in northeast Iowa.

The Ghost Players and everyone else can get ready for more next year.

CLICK HERE TO GET THE FOX NEWS APP

"You never mess with a winning streak, but it does feel like all the teams are going to want to touch this. There's going to be hot competition to play this," Costner said before the game.

Fox News' Stephen Goin and The Associated Press contributed to this report