DENVER (AP) — Kobe Bryant tied a season high with 31 points after missing a game with a sore right shoulder, and the Los Angeles Lakers rallied from a 21-point, first-half deficit to beat the short-handed Denver Nuggets 111-107 on Tuesday night.

Bryant also had five assists and played stellar defense to help bottle up the hot-shooting Will Barton, who had 23 points in the first half only to finish with 25.

The 37-year-old Bryant announced last month he would retire after the season. He received plenty of cheers during his penultimate game in the Mile High City, including chants of "Kobe! Kobe!" in the waning seconds.

Up 103-100 with 1:23 remaining, Bryant hit two free throws and then a jumper to seal the Lakers' fifth win of the season.

The Nuggets were without Danilo Gallinari (sprained left ankle) and Emmanuel Mudiay (sprained right ankle). Gary Harris went down with a strained right knee early in the game, but returned to score 21 points, tying a career high.

RAPTORS 103, MAVERICKS 99

TORONTO (AP) — DeMar DeRozan scored 28 points and Bismack Biyombo had a career-high 20 rebounds, leading the Raptors to the victory.

Kyle Lowry added 17 points, 10 rebounds and seven assists for Toronto, which swept the two-game season series against Dallas. Terrence Ross scored 16 points.

The Raptors appeared to be on their way to a comfortable victory with five minutes to go in the fourth. But the Mavericks battled back.

Jeremy Evans scored with 11.6 seconds remaining to trim Toronto's lead to 101-99, but missed a foul shot that would have got Dallas within one. Ross then closed it out with a couple of free throws.

Dirk Nowitzki led the way for Dallas with 20 points and seven rebounds.

PISTONS 93, HEAT 92

MIAMI (AP) — Kentavious Caldwell-Pope's jumper with 55.5 seconds left put Detroit ahead to stay, and the Pistons rallied from 18 points down for the road win.

Reggie Jackson led the Pistons with 18 points, while Stanley Johnson and Caldwell-Pope each had 14. The Pistons were 15 for 29 from 3-point range, outscoring Miami 45-12 in that department.

Chris Bosh scored 20 points for Miami, which missed a pair of go-ahead shots in the final three seconds. Dwyane Wade missed a 14-footer, and after Andre Drummond missed a pair of free throws at the other end and the Heat got the ball back with 1.1 seconds left, Bosh missed a jumper as time expired.

Wade finished with 19 points, and Hassan Whiteside had 16 points and 16 rebounds for Miami.

GRIZZLIES 104, 76ERS 90

PHILADELPHIA (AP) — Marc Gasol scored 19 points for Memphis, and Mike Conley had 18 points and six assists.

The Grizzlies had five players score in double figures. Courtney Lee had 15 points, reserve Zach Randolph added 14 points and eight rebounds, and Matt Barnes finished with 12 points and 10 boards.

Jahlil Okafor scored 18 points and Hollis Thompson contributed 16 for Philadelphia, which dropped to 1-29 while losing its 11th straight game. Now the 76ers head out for a six-game trip, and they have lost 22 in a row on the road.

Philadelphia had 28 turnovers and shot 65.6 percent (21 for 32) from the free-throw line.