Dallas came into Saturday’s afternoon game at Vivint Smart Home Arena boasting the NBA’s best offensive rating over the course of the season. The Jazz, meanwhile, had the league’s top offense over the past 20 or so games.

It was the perfect setup for a shootout for the ages — and it wasn’t far off, actually, with plenty of taut, back-and-forth, bucket-for-bucket action down the stretch.

In the end, though — naturally — it was yet more defense by Rudy Gobert that sealed the deal.

After Royce O’Neale drained a go-ahead 3-pointer, Gobert swooped in from behind to reject a Delon Wright layup attempt with 25 seconds to play, and one possession later, forced another miss at point-blank range, as Utah rallied and escaped with an improbable 112-107 victory.

“Every single game, he is a game-changer for us. He is playing on an MVP-level right now. No more [just] Defensive Player of the Year,” teammate Bojan Bogdanovic noted afterward.

Gobert finished with 22 points (on 8-of-8 shooting), 17 rebounds and five blocked shots.

The Jazz, meanwhile, finished with a big win in a Western Conference showdown — Utah’s fourth in a row overall, which bolstered the team’s record to 32-13 on the season.

It didn’t appear early on like it would go that way.

Dallas’ cadre of shooters effectively utilized a five-out attack at the outset, with Kristaps Porzingis positioned on the 3-point line in an attempt to neutralize Gobert’s impact.

And it was working to perfection, as the Mavs got most of the looks they wanted, hitting 14 of 25 shots in the first quarter, including 6 of 11 from deep, which yielded a 36-point outburst and 11-point lead, as the Jazz went just 8 of 19 overall.

“They’re such a unique team offensively. And particularly in the first half, the floor is so open, and they drive, and there’s a tendency to help, and that’s when they really both punish you from the 3-point line and [with] the slashers and the offensive rebounds,” noted coach Quin Snyder. “It took us awhile to get more disciplined in those situations. Our defense improved as the game went on, and I thought that was the difference.”

Indeed, Utah began to make up ground, particularly when second-year superstar and All-Star Game starter Luke Doncic went to the bench.

A 12-0 run to start the second period put Utah ahead for a couple seconds. After going down 10 again later in the quarter, Utah responded with an 8-0 run. No longer were defenders so frequently losing their man on off-ball actions; meanwhile, they began hitting the boards hard on offense, leading to second-chance points.

While Dallas always seemed on the verge of pulling away — be it via Tim Hardaway Jr. draining a tightly contested 3 in Donovan Mitchell’s face, or a Jazz defender losing track of his man on an out-of-bounds play and surrendering a layup, or on account of too many empty offensive possessions by the Jazz, culminating in a missed deep jump shot — Utah ultimately always seemed to find the right answer, with just about everyone playing a part.

And so, despite being outplayed for long stretches, the Jazz nevertheless found themselves within striking distance on multiple occasions as the game began to wind down.

Gobert got the crowd roaring in the third when he swatted a Porzingis shot, grabbed the board, took off downcourt like the point-center he dreams of being, then located Joe Ingles for a dime on a corner 3.

Mitchell nailed back-to-back 3s early in the fourth to close the gap. Bogdanovic hit a pair of long jumpers around the 3-minute mark to again stymie Dallas’ momentum. And after another Mitchell trey tied the game with just over a minute and a half left, O’Neale and Ingles surprised Doncic with a converging double team, causing him to lose control. While Mitchell’s ensuing layup try rimmed out, a trailing Gobert was right behind to ram it home.

“We handled our business. At the end of the day, we showed a lot of composure, we knew what we wanted to get to,” said Mitchell, who finished with 25 points, eight rebounds and five assists. “… We all did every little thing. We boxed out, we rebounded. I think that we did everything that we needed to do to win that game and that’s how you win tough games.”

Of course, the tough win still wasn’t secured until O’Neale drained that 3, and Gobert made up ground on Wright, taking away what looked to be a tying basket.

“I’m convinced he let guys lay it up at the beginning of the game so he could block it late,” Mitchell joked. “He’s an All-Star.”

Gobert, told of his teammates’ plaudits, said he appreciated the praise, but added that picking up the victory — as a team — was what mattered most.

“For me, winning is the No. 1 thing. How can I help my team win?” he said. “I mean, DPOY is great — it’s an award, it’s hardware, it’s great for your legacy; MVP, too. But at the end of the day, winning a championship beats all that. We win because we play well as a team. … We’re only winning because we’re doing it together.”