Courtney Lee scored 18 points, Lance Thomas added 17 and the New York Knicks used a big fourth quarter to rally past the Orlando Magic, 113-105 on Monday night.

Willy Hernangomez had 14 points and eight rebounds, while Kristaps Porzingis scored 14 points for the Knicks, who stopped a two-game losing streak. Kyle O'Quinn sparked the comeback with 11 points and eight rebounds, all in the fourth quarter.

Elfrid Payton had his first triple-double of the season with 16 points, 10 assists and 11 rebounds. Evan Fournier led Orlando with 25 points and Aaron Gordon had 17 in the Magic's third loss in four games.

New York outscored Orlando 28-13 in the fourth period, holding the Magic to just 17.6 percent shooting (3 of 17), while shooting 54.5 percent (12 of 22).

New York scored 10 straight points to start the fourth quarter and eventually pushed that to a 23-4 run that turned a seven-point deficit into a 108-96 lead with 4:38 left in the game.

O'Quinn, who played just 20 seconds in the first three periods, sparked the late run. The former Orlando forward hit all five shots from the field and grabbed four rebounds during the run as the Knicks suddenly came alive at both ends of the floor.

New York limited Orlando to 1-of-8 shooting and four turnovers in the first seven minutes of the final period.

Knicks leading scorer Carmelo Anthony sat out the game with a sore knee and the Magic went right at his replacement, backup point guard Ron Baker, on virtually every possession. Fournier scored 11 points on him in the first six minutes, before New York went away from the attempt at a small-ball lineup.

TIP INS

KNICKS: Anthony, who has averaged 26.2 points and 7.1 rebounds in his career against the Magic, is expected to play Wednesday in Milwaukee. ... New York started a three-guard lineup of Derrick Rose, Baker and Lee. ... The Knicks missed their first six shots and trailed 11-0 to start the game.

MAGIC: Nikola Vucevic missed his second straight game with a sore Achilles tendon. ... Fournier had 18 points in 14 minutes in the first half. ... The Magic led by as many as 14 in the first half, before settling for a 54-51 halftime edge. ... The Magic lost at home to New York for the second time in less than a week.

UP NEXT:

KNICKS: Play at Milwaukee on Wednesday night. It's the second of a four-game road swing for the Knicks.

MAGIC: Host Chicago on Wednesday night. The Magic are 0-2 against the Bulls this season.