Updated

Brandon Knight made back-to-back 3-pointers late in the fourth quarter, helping the Detroit Pistons beat the Orlando Magic, 104-102, on Sunday.

Knight went 12-of-16 from the floor and made five 3-pointers en route to 31 points for the Pistons, who snapped a two-game skid. Greg Monroe added 17 points, seven rebounds and six assists.

"The ball bounces funny sometimes," Knight said. "But still, you've got to be there and get some of those bounces and make some of the effort plays ... I gotta commend my teammates on making some of those effort plays toward the end of the game."

J.J. Redick made eight 3-pointers and ended with 31 points for the Magic, who have lost five in a row and 16 of their last 18 games. Jameer Nelson and E'Twaun Moore had 18 points apiece.

Glen Davis donated 17 points and 12 rebounds for Orlando, which fell to 8-16 at home this season. Nikola Vucevic tallied 12 points and 17 boards.

Trailing by five, 95-90, late in the fourth quarter, the Magic went on an 8-0 run to take the lead. Moore tallied six points during the burst, including a three-point play with 2:50 remaining to make it 98-95.

Knight stopped the spurt with a 3-pointer. His game-tying shot came after Tayshaun Prince and Monroe each grabbed key offensive rebounds.

Davis was called for an offensive foul on Orlando's ensuing possession, which led to another Knight 3-pointer. Monroe added a layup following Redick's turnover.

Moore stopped the run with a floater in the lane, cutting the gap to 103-100 with 1:19 to play.

With a chance to extend Detroit's margin, Prince missed a hook shot with 34.9 seconds to go. He grabbed his own rebound before throwing the ball away.

Redick missed a shot from beyond the arc at the other end. Will Bynum went 1- of-2 from the line with 8.2 seconds left to make it a 104-100 game.

Things got interesting when Nelson was fouled on a shot from beyond the arc. After making the first two foul shots, Nelson missed the third. A scramble for the rebound ended with Davis controlling the ball under the basket. Monroe blocked his layup and the Magic missed three putback attempts as time expired.

"It just seems like it's getting more and more frustrating," Redick said. "The way we're losing is tough."

The Pistons led by as many as nine in the first quarter and took a 29-25 lead into the second.

Orlando scored the first seven points of the second stanza, but Detroit responded with a 16-0 run. Charlie Villanueva tallied seven points during the surge to help give the Pistons a 45-32 edge with 5:23 left. It was 54-44 at the break.

The Magic got back in the game with a big third quarter. Trailing by eight, 66-58, with 7:36 to go, Orlando went on a 7-2 spurt to make it a three-point contest.

Moore's floater with 28.2 seconds left got the Magic within one, 78-77, heading to the fourth.

Game Notes

The Pistons improved to 5-16 on the road this season ... Villanueva and Kyle Singler had 12 and 10 points, respectively ... Orlando turned the ball over 15 times, leading to 21 Detroit points.