Updated

Alan Anderson came off the bench and erupted for 26 points, and the Toronto Raptors shut down Carmelo Anthony and the New York Knicks in a 92-88 victory at Madison Square Garden.

DeMar DeRozan added 20 points for the Raptors, who head into the All-Star break riding a four-game win streak despite Rudy Gay being limited to 11 points on 4-of-21 shooting.

"We're still not a finished product, we're a work in progress," Raptors head coach Dwane Casey said. "We're still grinding, and we have to continue to do that."

Anthony also struggled offensively, hitting just 5-of-24 from the field in a 12-point, 12-rebound effort for the Atlantic Division-leading Knicks, who have dropped three of their last four.

After the game, Anthony noted he played through a right arm injury and said he would not participate in Sunday's All-Star Game if it did not heal.

J.R. Smith netted 26 points and Raymond Felton had 16 in defeat.

The Knicks trailed the entire fourth quarter but had a chance to pull within one down the stretch, only to have Anthony miss a contested layup.

Gay went 1-for-2 from the free throw line at the other end for an 84-80 lead with 2:33 remaining, and New York came away empty on its next three possessions, as Anthony and Smith each missed from long range and Smith had a transition layup rim out.

John Lucas III's baseline fadeaway made it a six-point game with under a minute left, and the Raptors held on from there.

"It was an ugly game," said Knicks center Tyson Chandler. "All the missed layups and free throws, brain freezes on defense, it was just an ugly game."

A low-scoring first period ended with the Knicks holding an 18-14 lead.

Steve Novak came off the bench early in the second quarter and made three 3- pointers during a 16-2 run that gave the Knicks a 38-27 lead with 4:50 remaining in the half.

From there, New York started its decline, and failed to hit a field goal over the last four minutes of the half. Toronto pulled within 42-37 at the break and held the Knicks to 4-of-21 shooting in the third frame.

An 11-2 run spanning the third and fourth quarter gave Toronto a 69-60 cushion it never relinquished. The spurt was even more impressive considering Kyle Lowry, the Raptors' starting point guard, was ejected late in the third after receiving his second technical foul.

Game Notes

The Knicks won the rebounding battle, 52-35, but shot 35 just percent from the floor ... The Raptors are off until next Tuesday when they visit the Washington Wizards ... The Knicks host the Indiana Pacers next Wednesday.