ORLANDO, Fla. (AP) _ Darrell Armstrong had 22 points, 14 assists and seven rebounds, and Tracy McGrady scored 26 points as the Orlando Magic defeated the Detroit Pistons 102-96 Thursday night.

Detroit, which lost for the 14th time in its last 15 games in Orlando, got within 97-94 on a 3-pointer by Chucky Atkins with 21.4 seconds left. But Armstrong was fouled on Orlando's next possession and hit two free throws with 16.2 seconds remaining.

Detroit's Jerry Stackhouse had 34 points, hitting 12-of-26 from the floor and 7-of-11 from the line. Ben Wallace had 19 rebounds and six points, but made only 2-of-10 free throws. As a team, the Pistons were only 24-of-42 (57.1 percent) from the line.

Atkins finished with 16 points, but hit only 5-of-14 shots. Dana Barros had 11 points and Joe Smith and Mateen Cleaves 10 apiece for the Pistons.

Reserve Monty Williams scored 15 points, including six at the start of the fourth quarter, to put Orlando ahead 86-76 with 9:07 remaining.

Armstrong's 3-pointer with 4:15 remaining in the third quarter gave Orlando its biggest lead at 70-60. Cleaves made consecutive field goals in the final 59.5 seconds to close the Magic's lead to 78-72 heading into the final quarter.

A 3-pointer by Atkins tied the game 39-39 with 6:16 remaining before halftime. McGrady scored six of the Magic's next seven points as Orlando led 46-39. Detroit outscored Orlando 12-9 from there to trail 55-51 at the half.

Notes: Detroit activated forward Jerome Williams (sprained ankle) and placed rookie forward Brian Cardinal (knee tendinitis) on the injured list. Williams missed 10 games after being inactivated Dec. 9. ... Andrew DeClercq made his first start in 17 games this season for Orlando. ... Armstrong's 14 assists tied a career high.