DETROIT (AP) Trey Lyles scored eight of his 16 points in the fourth quarter and the Detroit Pistons won for the third time in five games, beating the Orlando Magic 97-92 on Saturday night in a matchup of the NBA's two worst teams.

''We know they are going through a lot of the same things that we are this season,'' Pistons coach Dwane Casey said. ''These are two teams learning how to win close games down the stretch, and there were a lot of mistakes down the stretch, but we made some nice plays as well.''

After ending last year with 18 losses in 19 games, the Pistons have beaten San Antonio, Milwaukee and the Magic since New Year's Day. They improved to 8-30.

Hamadou Diallo added 17 points, and Saddiq Bey had 16 points. Lyles also had 13 rebounds.

''We've learned that, even when our shots aren't going in, we can still play defense and keep ourselves in games,'' Bey said. ''We're getting guys back from COVID and we're starting to finish off a few of these games.''

Gary Harris had a season-high 28 points for the Magic. They have lost eight straight to fall to 7-33.

''We've worked a lot on game-ending situations in the last couple weeks, but we still aren't turning that into wins on the court,'' Harris said. ''We know what we need to do, but we have to step up and make the plays.''

The Magic have lost their last four games by an average of 5.5 points, including one in overtime.

''These games sting right now, but they are going to be super valuable for us in the long run,'' Magic coach Jamahl Murray said. ''We're learning how to get shots down the stretch, and we were one or two makes away from winning this game,''

Lyles scored eight points in the first 2:27 of the fourth to put Detroit up 81-75.

Harris' layup brought Orlando to 86-85 with 5:35 left, but Cory Joseph responded with a 3-pointer. Diallo missed a dunk that could have put the Pistons up 95-90 with 1:10 left, and Terrance Ross made it 93-92 with two free throws at the other end.

Diallo had a dunk on the next possession, restoring Detroit's three-point lead, and Ross missed at the basket.

''We showed a real defensive focus tonight - something we didn't have when we lost the last two games by 30,'' Casey said. ''We got excited at the end, but Cory did a nice job of calming down our young guys.''

Cade Cunningham missed a 3-pointer with eight seconds left, but Cole Anthony missed a tying 3-pointer before Joseph hit two free throws to clinch it.

''We did a lot of good things to get us back into the game in the third quarter, but we got away from them down the stretch,'' said Anthony, who finished with 19 points, eight rebounds and six assists. ''That's on me, because Gary was hitting everything and I didn't get him enough shots, and I needed to get Franz (Wagner) going down the stretch.''

TIP INS

Magic: Harris, who played at Michigan State, had never scored more than 13 points against the Pistons.

Pistons: Detroit's 31-26 lead after 12 minutes was the first time it had led at the end of the first quarter since Dec. 10 in New Orleans.

UP NEXT:

Magic: Host Washington on Sunday night.

Pistons: Host Utah on Monday night.

Copyright 2024 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.