Tracy McGrady scored 29 points and blocked an ill-advised shot by Charlie Ward with five seconds left as the Orlando Magic closed the game with an 18-2 run and beat the New York Knicks, 94-90, Sunday night.

The collapse was the latest in a series of them for New York, which has shown a penchant lately for blowing leads late in games. Losing for the fifth time in their last six home games, the Knicks were booed off the court.

The crowd also booed Allan Houston early in the third quarter after he missed a free throw to remain scoreless, but the Knicks seemed to have won the fans over and have the game in hand after Latrell Sprewell hit a jumper for an 88-76 lead with 4:33 left.

The Knicks missed three shots on their next possession and suddenly couldn't score. McGrady scored on a drive and Mike Miller and Pat Garrity hit consecutive 3-pointers in an 11-0 run that made it 88-87. After Houston hit a 23-footer, McGrady was fouled by Sprewell as he went up for a dunk, and he converted the three-point play to tie it at 90.

Houston missed on a drive, and McGrady drew Shandon Anderson's sixth foul by driving around him and into the lane. McGrady hit both free throws with 17.1 seconds left for a 92-90 lead.

The Knicks then ran a two-man isolation play with Charlie Ward and Sprewell, but Ward -- hounded by the taller McGrady -- could not or would not throw an entry pass to Sprewell.

Instead, he hoisted a 3-pointer that was blocked by McGrady.

Troy Hudson grabbed the loose ball and was fouled, making both free throws to ice the win.

Hudson scored 15 and Miller 13 for the Magic.

Sprewell led the Knicks with 28, Houston had 17 and Kurt Thomas added 16.

Houston heard scattered boos late in he first half when he missed his sixth consecutive field goal attempt.

The taunts seemed to inspire Houston, who hit three shots over the rest of the quarter and began the fourth with consecutive 3-pointers for an 81-66 lead.

The Knicks came back from an early nine-point deficit and took a 49-43 halftime lead behind 21 points from Sprewell.