Updated

Gordon Hayward drained the go-ahead basket with less than five seconds remaining and the Jazz overcame a 13-point fourth quarter deficit to take a 104-102 decision over the Sacramento Kings.

Following an Aaron Brooks turnover, the Jazz had the chance to hold for the final shot. Hayward, who has thrived since coming off the bench, scored a game-high 23 points and buried a wide-open look off a screen from 22-feet out to put the Jazz ahead.

The Kings didn't have a timeout to spare, but James Johnson hustled up the court and got in the paint for an uncontested running layup, but it was too strong and Utah held on to stay undefeated at home.

Marvin Williams donated 20 points in the winning effort, while Derrick Favors finished with a double-double. He scored 16 points and pulled down 14 boards for the Jazz, who won their third straight game and are now above .500 for the first time since winning their season-opener.

Utah's Al Jefferson added 19 points and eight boards in the first of a home- and-home against the Kings. The teams will travel to Sacramento to play on Saturday.

"It's going to be tough playing at their home," said Favors, whose team is just 2-6 on the road this season. "We just have to come out with the same mentality and try and win the game."

Coming off a big win against the Los Angeles Lakers, Tyreke Evans paced the Kings with 19 points and Marcus Thornton had a big fourth quarter to finish with 18 points, but Sacramento fell apart late and blew a double-digit lead.

"Mental mistakes, mistakes down the stretch, fouling, fouling, all those things put us in a tough situation to win," said a frustrated Kings coach Keith Smart. "Mental mistakes that I've talked about all year killed our team tonight."

Sacramento held an 80-73 lead after three and Thornton helped balloon the advantage to 13 early in the fourth. He scored eight straight points, following a layup with a triple and a three-point play to give the Kings an 88-75 lead with 10:03 to go.

But Hayward scored on an alley-oop dunk to spark a 19-9 run and bring Utah within three with 3:25 left in the game.

Jefferson then hit a short turnaround shot before Williams and Jamaal Tinsley each sank a pair of free throws to put the Jazz on top, 100-99, with 2:11 to play.

Off a Williams miss, Jefferson grabbed the offensive rebound and was fouled going up with a shot. He bounced in two free throws to extend the Jazz's lead to three with 58.8 seconds left, but Thornton answered for Sacramento.

Following a timeout, Thornton came off a screen and drained a 3-pointer to tie the game at 102-102.

DeMarcus Cousins then hauled in a rebound off a Tinsley miss, but Brooks was unable to put the Kings back ahead.

He called for an isolation with the clock running down, but Tinsley stripped him of the ball as he was going up, giving the Jazz the opportunity to hold for the final shot with 12.6 remaining.

Hayward then drained what turned out to be the game-winning shot on the ensuing possession.

"It's good that he made that," said Tinsley, who delivered the pass to Hayward on the final score of the game. "I would give it to him again if he had missed it, but it went in and we got the win."

The Kings came out with a hot shooting touch to start the game, converting on 13-of-21 from the field in the first quarter. Brooks scored 10 in the period and helped Sacramento out to a 32-28 edge.

The Jazz trailed most of the second period until Randy Foye knocked down a pair of triples later in the quarter. His first tied the game and his second, with 51 seconds left until halftime, gave Utah a 50-49 lead.

However, Evans hit a pair of free throws and then buried a long jumper to keep the Kings ahead at the break, 53-52.

Sacramento created some separation in the third, as Evans and Brooks drained back-to-back 3-pointers to spark a 10-0 Kings' run for a 71-62 advantage.

Williams' jumper with 1:33 to go in the period clawed the Jazz to within four, but the Kings wound up taking an 80-73 lead into the final stanza.

Game Notes

Utah's Mo Williams rolled his ankle in the first quarter. He tried to return in the second but left soon after and did not return for the rest of the game ... The Jazz improved to 60-24 all-time at home against the Kings.