ORLANDO, Fla. (AP) – Garrett Temple scored 19 of his career-high 34 points in the fourth quarter to lift the Sacramento Kings to a 105-99 win over the Orlando Magic on Tuesday night.

Willie Cauley-Stein had 21 points and nine rebounds and Buddy Hield added 13 points for the Kings, who stopped an eight-game losing streak. Temple accounted for all of Sacramento’s points during a 17-6 run that put the Kings ahead 103-97 with 23.5 seconds to go.

Evan Fournier led the Magic with 22 points and Elfrid Payton had 21 points, seven assists and seven rebounds. Aaron Gordon added 16 and Jonathon Simmons had 14 for Orlando, which struggled mightily to score in the final quarter.

Payton’s pull-up jumper with 7:13 remaining had given the Magic 91-86 lead. Orlando made just one more field goal – a dunk by Bismack Biyombo with 5:330 left – before Payton made a meaningless layup with under one second to play.

Sacramento rallied from an 11-point third-quarter deficit to take a 94-93 lead on Temple’s 3-pointer with 5:11 left in the game. Temple followed that with two perimeter jumpers and another 3-pointer to help the Kings to a 101-97 lead with 1:31 to go.

The two teams played dead even for the first 30 minutes of the game before Simmons hit a hot streak that gave the Magic their biggest lead of the game, 79-68. The Magic forward scored 14 points in the third period, including three 3-pointers and a three-point play.

However, as was the case all game, the Magic defense gave up the lead almost as fast as they got it.

Hield started the comeback with a 3-pointer and Cauley-Stein continued to be unguardable in the paint. His dunk cut the deficit to 82-77 by the end of the third quarter. A three-point play by Skal Labissiere made it a one-point game with over minutes to play.

TIP INS

Kings: PG De’Aaron Fox left the game with 5:03 left in the second quarter with abdominal strain. … PF Zach Randolph, who has started 39 games this season, was inactive. He has no injury, but didn’t play for the second straight game. His replacement, Labissiere, had 10 points and nine rebounds. . C Cauley-Stein got off 10 shots the first quarter.

Magic: Haven’t won consecutive games since beating the Knicks and Suns 10 weeks ago. … SG Aaron Afflalo was in uniform after serving a two-game suspension for fighting. He did not play. … PF Gordon had five of the team’s nine turnovers in the first half. … SF Mario Hezonja has hit just four of 20 3-point attempts over the last five games. … The Magic presented $1 million worth of checks to 27 local charities during a halftime ceremony.

UP NEXT

Kings: At Miami, where the Kings haven’t won in 16 years, on Thursday night.

Magic: At Indiana on Saturday night. Orlando is 0-2 vs. Pacers this season.