TORONTO - Linsanity prevailed at the Air Canada Centre on Tuesday.

Jeremy Lin, the NBA phenomenon who went from a seldom-used player to the league's hottest story in the span of a week, drained a three-point shot with 0.5 seconds on the clock to lift the New York Knicks to their sixth consecutive victory, 90-87 over the Toronto Raptors.

The 23-year-old point guard finished with 27 points and a career-high 11 assists, and was huge down the stretch, scoring the final five points for New York (14-15) in one of the most thrilling games at the Air Canada Centre in recent memory.

Jose Calderon had 25 points and nine assists to top the Raptors (9-21), who coughed up a 17-point first-half lead in the loss.

Lin is coming off a dream first week as an NBA starter -- earning Eastern Conference player of the week honours -- and he put in another magical performance in Toronto. On the Knicks' final possession, Lin dribbled the ball just past halfcourt while watching the clock, then drive to the three-point line before launching the dagger.

Linas Kleiza finished with 15 points for the Raptors, while DeMar DeRozan added 14, Leandro Barbosa had 13 and Amir Johnson chipped in with 10.

Amare Stoudemire scored 21 points in his first game since the death of his brother, while Tyson Chandler added 21. Stoudemire was excused from the team last week after his brother Hazell was killed in a car accident.

The Raptors led for most of the night in front of a soldout Air Canada Centre crowd of 20,092, and were up by as much as 17 points in the second quarter before taking a 75-66 advantage into the final 12 minutes.

The Knicks kicked it into another gear in the fourth, and when Stoudemire followed up a monstrous dunk with a layup with 6:28 left in the game, New York trailed just 78-76.

Lin got off to a slow start, pestered by Calderon, who was coming off a career-high 30-point performance on Sunday versus the L.A. Lakers. The 23-year-old looked weary both emotionally and physically. His first basket didn't come until more than eight minutes into the game, but it was cheered loudly by the crowd on hand.

Lin, a Harvard grad who went undrafted and was cut by both Houston and Golden State, launched himself into the NBA spotlight last week, averaging 27.3 points and 8.3 assists in his first four starts.

The game was just the Raptors' second sellout this season -- the other was the home-opener -- and orange-and-blue Knicks jerseys dotted the crowd. One row of fans wore T-shirts that spelled out L-I-N 4 M-V-P. Among the Lin signs in the crowd: "Be my val-LIN-tine," and "The sky's the Lin-it."

Musician and actor Steven Van Zandt, who sat courtside, was among capacity crowd hoping to experience some Linsanity.

The Raptors, who were coming off a victory over Boston and a two-point loss to L.A., got off to a hot start Tuesday as Calderon's three-pointer with 3:25 left in the first put the Raptors up by nine. Leandro Barbosa went coast-to-coast and finished with a layup at the buzzer to give Toronto a 28-21 lead heading into the second.

Toronto padded its lead in the second and a pair of Barbosa free throws would put the Raptors up by 17 with 2:35 to go. A Lin three-pointer and four free throws cut the Raptors' lead to 47-36 at halftime.

The Knicks fought back in the third and a three-pointer by Steve Novak cut Toroto's lead to seven. The Raptors ended the third up 75-66.

Notes: Toronto head coach Dwane Casey was presented his NBA championship ring before the game. Casey was an assistant coach with the Dallas Mavericks last season when they beat Miami to win the NBA title. Casey accepted the ring from Knicks centre Tyson Chandler, who also played on Dallas' championship team last season. . . Toronto's leading scorer Andrea Bargnani missed his 17th of 19 games with a strained calf muscle. . . Raptors guard Jerryd Bayless sat his third consecutive game with an ankle injury. . . The Raptors host the San Antonio Spurs on Wednesday.