DENVER -- What looked like a rout turned into a grind.
Cruising with a 17-point lead midway through the fourth quarter, the Denver Nuggets looked as if they would stroll to a victory.
Instead they had to sweat out a 113-110 win over the Toronto Raptors, who nearly pulled out an unlikely victory.
"We stopped making shots, they started making shots," Nuggets forward Corey Brewer said. "NBA teams are going to make runs, and they made their run late."
Brewer had 19 points, and JaVale McGee added 17 points and five blocked shots for the Nuggets, who snapped a three-game losing streak.
Kenneth Faried had 18 points and 10 rebounds for the Nuggets, who also got 10 points and 10 boards from Kosta Koufos.
Denver led 103-86 midway through the fourth when Toronto came alive. Kyle Lowry, who led the Raptors with 24 points, scored 12 in the final period and powered the rally. He scored on a three-point play, Terrence Ross had a fast-break dunk and Andrea Bargnani hit a reverse layup as Toronto scored 11 straight points to make it 103-97 with 3:41 left.
"We made a commitment in the second half to play defense the whole time," Lowry said. "I don't think in the second half that they had too many fast-break points. We have to play like we did in the second half in the first 24 (minutes)."
Toronto outscored Denver 18-2 in a 3:49 stretch to pull within 105-104. Lowry hit two free throws to get the Raptors within one, but they couldn't overtake Denver.
"They had every opportunity to give in and give up, but they didn't," Raptors coach Dwane Casey said.
Ty Lawson hit a 3-pointer to push the lead to 108-104, and after three missed shots by Toronto, Danilo Gallinari hit two free throws to make it 110-104.
Lowry and teammate Amir Johnson sank 3-pointers around two free throws from Denver's Andre Iguodala to make it 112-110 with 7.9 seconds left.
Faried was fouled, and he hit one of two free throws with 5.8 seconds left. Toronto's DeMar DeRozan missed a long 3-point shot at the buzzer that would have tied it.
"The momentum swing of an NBA game can happen when two very good players take control," Nuggets coach George Karl said. "It was a positive to have a close game and have to win it."
Bargnani had 23 points for the Raptors, who lost for the seventh time in eight games. DeRozan added 18 points and seven rebounds.
Toronto trailed by 17 at halftime before Bargnani scored the first five points of the third quarter to pull the Raptors to within 61-49. They cut it to 11 on another 3-pointer from the 7-footer before Denver got the lead back to 17 on consecutive 3-pointers from Gallinari.
Denver led 89-75 after three quarters.
"If we would have made free throws and played defense, we would have made it a 20-point game," Karl said. "The momentum swung on us about the eight-minute mark of the fourth quarter."
With help from their bench, the Nuggets began to pull away late in the first quarter. Brewer came in for Gallinari and made an immediate impact, scoring six quick points on dunks and a layup. McGee also scored four points for Denver, which ended the period on a 10-2 run to take a 29-24 lead.
The subs continued to push the pace in the second quarter to get easy baskets. Brewer had a dunk, McGee had a free throw and Jordan Hamilton added an alley-oop basket as the Nuggets stretched the lead to 38-26.
Things didn't get much better for the Raptors. Brewer hit a 3-pointer from the corner and had a tip-in that made it 45-32 and gave him 15 points in just 10 minutes. McGee had 11 at intermission.
The lead grew to 19 on six straight points by Hamilton.
DeRozan scored 14 first-half points and Bargnani had 13 to keep the Raptors within striking distance, but Lawson hit a floater in the lane at the buzzer to give the Nuggets a 61-44 lead at halftime.
"We gave them fast breaks," DeRozan said. "That was the only time they were scoring on us. They weren't really scoring in the halfcourt. Once they got the fast breaks going, they took advantage."
NOTES: Raptors forward Linas Kleiza sat out with a sore left hip. He had an MRI done Monday, but the results were not back. ... Nuggets forward Wilson Chandler, who has missed the last 10 games while trying to recover from offseason surgery on his left hip, will not join the team on its upcoming five-game road trip. ... Brewer briefly went to the locker room in the second quarter but was back on the bench before halftime.