TORONTO -- DeMar DeRozan had 22 points and John Lucas had 12 of his 14 points in the fourth quarter as the Toronto Raptors won their third straight by defeating the short-handed Denver Nuggets 109-108 on Tuesday night.

Rudy Gay, plagued by foul trouble, finished with 17 points but hit the go-ahead shot in the final minute of the game. He had led the Raptors in scoring with 20 or more points in five games since coming over in a trade with Memphis.

Alan Anderson had 10 points while Kyle Lowry added 11 points and 10 assists for Toronto (20-32).

Ty Lawson paced Denver (33-20) with 29 points and nine assists. The Nuggets lost their second straight after having their nine-game win streak snapped Sunday with a 118-114 triple overtime loss in Boston to the Celtics.

Denver was missing starting guard Andre Iguodala (neck strain), small forward Danilo Gallinari (sinus infection) and reserve guard-forward Wilson Chandler (groin).

Lucas, who scored 10 points in the fourth quarter in Sunday's win over New Orleans, went to work from downtown early in the final quarter, jacking up three straight threes to give Toronto a 91-83 cushion. After Denver pulled back within two, Lucas hit another three before dishing to Anderson who dropped in a long ball to make it 100-94 with five minutes left.

Lawson's six points in the paint and a reverse layup from Corey Brewer rallied Denver and the game was tied 102-102 with just under three minutes to play.

With just over a minute left to play and Toronto holding a slim one-point lead, Denver stopped Gay on a drive before drawing a foul at the other end. Anthony Randolph converted to put the Nuggets in front by one, but with the final possession Gay hit a clutch jumper from the wing and the arena erupted with 4.8 seconds left.

Lawson's desperation shot clanged off the rim.

Gay ran into foul trouble early in the third and had to watch from the bench as the Nuggets tied the game 63-63 on two Kenneth Faried dunks and a Lawson fast-break layup. After Toronto head coach Dwane Casey called timeout, the Raptors immediately turned the ball over leading to another Faried slam and a Denver's first lead of the game, 65-63 at 7:02.

Boos could be heard as Andrea Bargnani -- returning to action after missing Sunday's game with the flu -- missed an open three and a pull-up jumper in the final minutes of the quarter, which Toronto closed out ahead 82-78 thanks to Lucas' layup and DeRozan's short jump shot.

DeRozan posterized Nuggets centre Timofey Mozgov seconds into the second quarter with a thunderous one-handed jam, putting Toronto up 30-21. Raptors rookie Terrence Ross got in on the aerial attack with a Blake Griffin-like slam midway through the quarter -- a glimpse of what he plans to bring to the upcoming all-star dunk competition.

The Raptors, however, played sloppy late in the second as Denver went on a 9-0 run and guard Ty Lawson poured in 14 points in the quarter to cut the lead to 54-52 going into intermission.

The Air Canada Centre crowd was on its feet early when DeRozan, soaring through a wide open lane, slammed home a one-handed dunk to make it 13-5. Gay followed that with a layup at 6:31, forcing Denver to call time out, and minutes later dropped a three to make it 22-9. He finished the opening quarter with 13 points.

Both teams head to New York to plays their final game on Wednesday before this weekend's all-star break in Houston. Toronto takes on the Knicks at Madison Square Garden, while Denver is across the Brooklyn Bridge taking on the Nets.

Notes: Toronto was without Linas Kleiza (sore right knee). ... Denver has won 15 of its last 18 games against the Raptors. ... Raptors coach Dwane Casey was an assistant coach for Denver coach George Karl in Seattle. ... Karl came into the game needing one win to reach for 400 with Denver. He is 48 wins shy of Phil Jackson (1155) on the all-time list. ... Canadian Olympian Clara Hughes was seated courtside. Hughes is leading a campaign to support mental health issues using the Twitter hashtag .Bellletstalk.