After all the agonizing scoreboard-watching the Jazz and their followers have done lately, everything around the NBA played out in their favor Saturday night.

This part was not in the preferred script, though: Sacramento possessed the ball in the last minute of a tie game at Vivint Smart Home Arena.

That’s when Rudy Gobert and the rest of the Jazz defense responded. Three empty trips for the Kings and a bunch of free throws for the Jazz secured a 103-97 victory, ending a night that reminded everyone how the should-win games in this league are not always easy.

This would have been a terrible one to give away, after the Jazz got the help they needed from Houston (vs. New Orleans) and San Antonio (vs. Minnesota) and endured their own struggles.

Yet the Jazz came through, earning a ninth straight win after the first eight had come by an average of 17.7 points. This one required a 48-minute effort against a Sacramento team that beat Golden State on the road Friday and would not go away against the Jazz (40-30).

Jazz coach Quin Snyder labeled it “as big a win as we’ve had this season, for a lot of reasons.” Anyone in the building would agree with a sense of relief, after the Jazz failed to subdue Sacramento until the last 24 seconds.

So the Jazz beat the Kings, 15 years after John Stockton’s last game in Salt Lake City resulted in a playoff loss to Sacramento. Stockton’s son David dressed but didn’t play after signing a 10-day contract with the team. Even so, he could claim to be part of a meaningful win — especially after the way this game unfolded.

The Jazz’s reward is joining a three-way tie with San Antonio and Minnesota for fifth place in the Western Conference with 12 games remaining, and they own the tiebreaker.

That’s a breakthrough. Remember how long it took for the Jazz to rise above 10th in the West? And now they’re not only two games inside the playoff cut, but they’re moving toward a more favorable matchup than meeting Houston or Golden State.

This race is so volatile, though, that failing to collect even one win that’s there for the taking would be costly. That could have happened Saturday. The Jazz never quite got control of this game, even when they produced a 15-0 run in the middle of the first quarter or when Donovan Mitchell’s lob pass accidentally went into the basket in the third period and they eventually led by 10 points.

Their lead was down to 80-79 entering the fourth quarter, when the lead changed hands eight times. The Jazz were still sweating, even after Mitchell’s drive and Joe Ingles’ 3-pointer made it 92-88.

Sacramento’s Buddy Hield somehow hit a 3-pointer to beat the shot clock. Later, Mitchell was blocked on a drive, giving the Kings a chance to take the lead.

Sacramento’s next three possessions ended with De’Aaron Fox’s missed jumper, Gobert’s block of Bodan Bogdanovic and Hield’s miss. The Jazz survived, thanks to the free-throw shooting of Ingles and Gobert.

“This whole team collectively has been great in the fourth quarter,” Mitchell said.

The Jazz had to live up to that description Saturday. And they’ve needed every bit of this run of 21 wins in 23 games to make any move in the standings. Asked why the Jazz have been so good lately, Kings coach Dave Joerger said, “They have to be. You’re in the West.”

The Jazz’s lengthy stay below the playoff cut “can be disheartening,” Joerger said, “but you’ve got to just keep putting your foot down on the pedal and they’ve done that. They’ve done a terrific job. They’re playing as well as anyone in the NBA right now.”

Before the game, Snyder was demanding even more of his team. “Our focus is forward,” he said. “That is what we want to talk about, even so much so that I would like to see us try to set a bar to get better, not to just win games.”