Tim Hardaway Jr. plays to the Garden crowd in the...

Tim Hardaway Jr.  plays to the Garden crowd in the third quarter, when the Knicks went on a 28-0 run and outscored Toronto 41-10. Credit: Jim McIsaac

It was a quarter for the ages.

The Knicks outscored the Raptors 41-10 in the third quarter, including an incredible 28-0 spurt, en route to a stunning 108-100 victory Wednesday night at the Garden.

The Knicks erased an 11-point halftime deficit with an array of offensive and defensive delights that brought the crowd to its feet. The dizzying surge came against one of the better teams in the East, one that blew out the Knicks Friday in Toronto.

The Knicks (10-7) entered the third quarter trailing 59-48. No worries! They ended it leading 89-69. The Raptors (11-6) made some runs of their own in the fourth and got the lead down to six. But the Knicks held on for their second win in a row.

In their 71-plus seasons, the Knicks never had scored 28 unanswered points and never had outscored an opponent by 31 in a quarter. They shot 15-for-23 (65.2 percent) in the third, when Tim Hardaway Jr. had 12 points, five rebounds and four assists.

Hardaway had a career-high 38 points, shot 13-for-27 and had seven assists and six rebounds.

“It’s great to be on that other end of the spectrum,” Hardaway said. “It’s just a fun style of play when we’re out there just having fun, man. Getting stops, we’re running, not worrying about who scores. Just doing what we can to get the fans involved and get them excited, get them hyped. We feed off their energy.”

Enes Kanter blocks a shot by Raptors' Kyle Lowry in...

Enes Kanter blocks a shot by Raptors' Kyle Lowry in the third quarter, when the Knicks went on a 28-0 run and outscored Toronto 41-10 at Madison Square Garden. Credit: Enes Kanter blocks a shot by Raptors’ Kyle Lowry in the third quarter, when the Knicks went on a 28-0 run and outscored Toronto 41-10 at Madison Square Garden.

Kristaps Porzingis scored 22 points — only two during the 28-0 run — and had 12 rebounds. Courtney Lee had 15 points, seven assists and five rebounds. Kyle Lowry had 25 points for Toronto, and DeMar DeRozan added 18.

“I don’t remember that many big swings like that,” coach Jeff Hornacek said. “It’s a little crazy. But that’s what this outside game does. You miss jump shots and the other team runs and gets fast breaks. Then all of a sudden those 25-footers that guys take, they’re a little tougher to take when you haven’t scored four or five times down the court.”

The third quarter started innocently enough with a jumper by Lee. Serge Ibaka made 1 of 2 free throws for Toronto before Lee hit another basket and Lowry hit two free throws to give Toronto a 62-52 lead with 10:47 left in the quarter. The Knicks scored the next 28 points. The Raptors didn’t score again until CJ Miles hit a three-pointer with 2:23 left in the quarter.

Here’s what 28 unanswered points over more than eight minutes of basketball look like:

Enes Kanter layup. Lee three-pointer. Kanter layup. Kanter free throw. Lee jump shot (score tied at 62). Hardaway layup (Knicks’ first lead since 6-3). Hardaway layup. Lee reverse layup. Hardaway layup. Kanter layup. Two Porzingis free throws. Two Hardaway free throws. Two more Hardaway free throws. Hardaway layup. Knicks lead by 18.

In the 28-0 run, the Knicks had eight layups, four steals and three blocks. For the quarter, the Raptors shot 1-for-16 and turned the ball over eight times, leading to 14 points. The Knicks outrebounded the Raptors 11-5.

The Knicks lost Friday in Toronto, 107-84, when their last lead in that non-competitive game was 4-2. The first half Wednesday looked like it might lead to a rerun. It turned out to be anything but.

“We just challenged guys at halftime,” Hornacek said. “We were playing hard in the first half, but Toronto, they’re a great team, they had a lot of energy . . . They really got after us. We were right there, down only 11, and they had hit 10 threes, so we challenged them at halftime to get after guys and put pressure, make nothing easy, and they responded in that third quarter. They were great. That’s effort.”

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 5 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME ONLINE