"It means a great deal to me to get this win," said Glen Davis, who had 16 points and eight rebounds. "We need to get as much games as possible and try to get back to .500 and compete for the chance to be somewhere in the postseason.
"And also for our confidence and our young guys to make sure that they can learn and understand what we have to do to take the win."
Davis had 10 points in Orlando's big fourth quarter. Nelson finished with six assists for the Magic (5-7), who have won two straight and continue their five-game homestand Sunday against Boston.
During the height of the Dwight Howard era, Orlando had a reputation for shooting lots of 3-pointers in some games. That changed following the arrival of new coach Jacque Vaughn's more motion-based system.
But for one night, at least, this new version of the Magic showed they still remember how to let the ball fly from deep. The 11 3s were a season high.
"You look down at the stat sheet and the minutes and there's numbers all over the place, guys contributing in a lot of different ways," Vaughn said. "Another example of how we can play as a team, band together, rebound together as much as we can, just getting it to the open guy (and) just keeping it simple."
Orlando led the league in made 3-pointers each of the last three seasons, but was making just over four per game this year.
Dion Waiters scored 25 points for Cleveland, and Anderson Varejao had 19. The Cavaliers have lost seven of eight and face Miami on Saturday.
Orlando had 16 turnovers in the first half, but just two after the break.
"I think that was the biggest difference," Cleveland coach Byron Scott said. "We didn't get up and pressure them like we did in the first half. ... Again, we allowed another team to shoot a high percentage tonight, and those guys shot the ball pretty well."
The Cavs also outscored the Magic 22-8 in the paint in the first half, but were outscored 32-18 inside in the final 24 minutes.
Saddled with turnover issues in the first half, the Magic trailed for most of the game but managed to make their surge by turning some of the Cavaliers' miscues into easy points. It was tied headed to the fourth quarter, and there were eight lead changes in the final 12 minutes.
Afflalo hit a 3-pointer from the wing with less than two minutes remaining, giving the Magic a 98-94 lead.
A free throw and tip-in by Tyler Zeller trimmed Orlando's advantage to a point, but a driving layup by Nikola Vucevic restored the Magic's three-point lead at 100-97 with 32.3 seconds to play.
J.J. Redick hit eight free throws in the final minute to help the Magic hold on.
The Magic also were continuing an adjustment period of sorts, with rookie Maurice Harkless receiving his second straight start at shooting guard, with Afflalo at small forward.
That experiment looks promising, with the athletic Harkless looking more comfortable and contributing on both sides of the floor.
The Cavaliers played their second consecutive game without point guard Kyrie Irving, who is recovering from a broken bone in his hand.
Jeremy Pargo, coming off a huge effort in his first start of the year, had 15 points for Cleveland. But he struggled to contain Nelson, whose outside shooting spread the floor and opened up Orlando's offense.
"It was crazy. They were making tough shots," Waiters said. "We contested and played defense and I think we played great defense. But they made a lot of tough shots, especially down the stretch."
Waiters said he even tried to resort to other means to shut down Redick, who had 18 points.
"I tried talking to him and say everything, but he was just knocking shots down," Waiters said. "I was telling him, 'Can you miss?' I was playing but I was serious, like miss a shot please."
Vaughn said he hopes his players take an important lesson from the win.
"It's that simple of first recognizing that we're putting ourselves in a hole because of the turnovers," he said. "It's just recognition and then just making the simple and easy play. That's it."
The Magic have won eight straight games over the Cavs, including 18 of the last 23 regular-season matchups. ... Davis went flying into the front row of courtside seats and landed on a fan while chasing a loose ball late in the fourth quarter. But both he and the spectator were fine, and Davis was able to return to the action.