LAS VEGAS — The earth moved in the fourth quarter of Friday night’s ballyhooed summer league-opening showdown between the Pelicans’ Zion Williamson and the Knicks’ RJ Barrett at the Thomas & Mack Center — but not the way you would have expected it.

With Williamson sitting out the second half because of left-knee soreness and Barrett having a horrible shooting night, the game shut down for good with 7:53 left when a 7.1-magnitude earthquake centered in the California desert delayed the game for 25 minutes before it was finally postponed for precautionary reasons with the Pelicans leading, 80-74.

According to summer-league president Warren LeGarie, the scoreboard initially swayed for several minutes, as did the speakers surrounding it. But LeGarie said the decision to halt the game was out of his hands and made by law enforcement. LeGarie told The Post the hanging equipment was installed one year ago with earthquake-safety provisions.

The showdown of former Duke standouts was so hyped it attracted LeBron James and Anthony Davis to sit courtside and Knicks owner James Dolan also dropped in for the sold-out game.

The quake came one day after a 6.4 earthquake also centered near Ridgecrest, Calif., rocked Las Vegas while the Knicks were on the team bus en route to practice.

Friday night, many fans decided to head for the exits the moment the second quake hit.

“I didn’t feel it on the court,’’ Knicks forward Kevin Knox said. “I just saw everyone screaming. I thought something happened in the stands. But everyone started leaving so I knew something happened. And then I saw stuff shaking so I got off the court. When things started shaking they told us to get off the court and go in the back.’’

The teams stayed in the locker room for a while before they officially canceled the contest. However, next door at Cox Pavilion, the games played on. Knox said the Knicks did not feel Thursday’s earthquake.

After Friday’s postponement, the Knicks were hurried onto the bus and neither summer league coach Jud Buechler nor Barrett was immediately made available for comment. The Knicks sent an audio file of Buechler, a Southern California native, saying it was the first time in 30 years of basketball he had experienced a quake during a game.

The Knicks were down six points when the game was stopped. It’s unclear if the final minutes will be played.

Both Barrett and Williamson were cheered wildly during pregame intros, but the showdown didn’t live up to the massive hype — even before the earth shook. Looking labored in the first quarter, Williamson got off to a slow start before picking it up, but then couldn’t finish.

Williamson developed left-knee soreness after a knee-to-knee collision and was shut down for the second half. He finished with 11 points and three rebounds in nine minutes.

Barrett, meanwhile, went through some of the shooting woes that plagued his season at Duke.

“My shot didn’t fall tonight, but I’m sure it will the next game,” Barrett said via an audio file.

In his first game since Duke got bounced by Michigan State in the Elite Eight, Barrett shot 4-for-18 — 1-for-8 from beyond the 3-point stripe — to tally 10 points before the postponement. Barrett also resorted to a lot of one-on-one play.

“There were ups and downs in the game for him,’’ Buechler said. “You expect that from a rookie. We saw a lot of things we liked. We will continue to encourage him to keep shooting and aren’t worried about his shot not falling tonight.’’

Knox, the Knicks’ 2018 lottery pick, had 17 points before the game was stopped.

Williamson had a slow start, shooting an airball and getting blocked inside by Mitchell Robinson.

Williamson was 0-for-3 before throwing down three straight dunks. Though he looked winded and not in great game shape, Williamson finished the first quarter 4-for-8 with 10 points, though he had two turnovers.

On the game’s first possession, the crowd roared as a lob went up to Williamson — but it was broken up by a Knox foul. Williamson made just one of the two free throws.

The third pick in the draft, Barrett struggled early to create his own shot and space. He hit back iron on his first attempt, an 18-footer. Then he missed on a runner. He wound up 3-for-9 in the first half as the Knicks led 56-49 after squandering a 20-point lead.

In the bowels of the arena, Dolan arrived in a white sports jacket, looking like he was going to front his blues band. James sat baseline in a purple Lakers hat and was joined late in the first quarter by his soon-to-be-teammate, Davis, who technically is still a Pelican until the trade is finalized.

New Knicks acquisition Julius Randle paid homage to James, as did the Ball brothers — Lonzo and LaMelo. New Orleans point guard Jrue Holiday also was part of the crowd.

Dolan huddled backstage for several minutes with Knicks president Steve Mills and general manager Scott Perry, who sat courtside with coach David Fizdale and his wife.