MIAMI — Wayne Ellington doesn’t play video games, so he doesn’t know what a cheat code is.

He gets the term now.

Josh Richardson scored 14 of his 20 points in the final quarter, Ellington made four 3-pointers in that game-deciding period and the Miami Heat finished with a flourish to beat struggling Orlando 107-89 on Tuesday night — beating the Magic for the first time in the teams’ last five meetings.

“We needed that one,” Heat guard Goran Dragic said. “Huge win for us.”

It was tied going into the fourth, and Miami — which trailed Orlando by 10 in the second half — outscored the Magic 39-21 in the final 12 minutes. All four of Ellington’s late 3s came in a span of 3 1/2 minutes.

“He’s a cheat code,” Orlando’s Jonathan Issac said, using the term video-gamers know as something that gives them special powers while playing.

Said Ellington: “I don’t really play video games, so I don’t know exactly what that means. But I’m guessing it’s a big compliment, so I appreciate that.”

Tyler Johnson added 17, Kelly Olynyk scored 15 and Dragic had 14 for the Heat, who had their biggest margin in a final quarter this season.

Hassan Whiteside returned from an 11-game absence with a bone bruise in his left knee, adding seven points and eight rebounds in 18 minutes.

“I don’t expect somebody to miss that many games and come right back in and everybody have terrific rhythm, including him,” Heat coach Erik Spoelstra said. “There’s going to be a little bit of a process.”

Elfrid Payton scored 19 points for Orlando, which now has two separate nine-game losing streaks this season. The Magic started 8-4, and are 3-20 since.

“We played extremely hard,” Magic coach Frank Vogel said. “I was proud of how hard our guys played.”

Evan Fournier and Mario Hezonja had 14 apiece for Orlando, which got 12 from Marreese Speights. After that 10-point lead, the Magic got outscored by 28 in the final 20 minutes.

“We had a lot of turnovers so that led to easy buckets,” Fournier said. “They got it going and the momentum changed.”

The Heat started 3 for 19 from 3-point range, then made eight of their final 14 from deep. Miami shot 56 percent in the final quarter, after shooting 41 percent through the first three, and outrebounded Orlando 19-6 in the fourth.

“We were getting good looks all night,” Ellington said. “The first half they didn’t really fall for us, but we stayed patient.”

TIP-INS

Magic: Orlando was missing three starters from its opening-night win over Miami — Nikola Vucevic, Terrence Ross and Aaron Gordon. Vucevic has had surgery to repair his fractured hand, and the Magic are hoping he’s back in about two months. … This is the first time since 2013-14 that the Magic have had multiple losing streaks of nine or more games in the same season.

Heat: Miami has 158 3-pointers in December, with two games left this month. The team record for 3s in a month is 182 — set last month. … It was the third game in an eight-game stretch where the Heat won’t leave Florida; seven of those at home, the other in Orlando. … Dion Waiters , James Johnson and Justise Winslow remained sidelined for Miami.

BLOCK OR CHARGE

Speights and Miami’s Jordan Mickey were both issued fouls with 9:50 left. Referee Eric Lewis called Speights for a block on Mickey’s drive, while ref Lauren Holtkamp under the basket had it as an offensive foul. The Heat wound up getting three points out of the possession; Richardson was fouled on a 3 and made all three free throws.

ONE MORE TIME

The teams end 2017 against one another Saturday in Orlando. The Magic are 3-1 against the Heat this year.

UP NEXT

Magic: Host Detroit on Thursday.

Heat: Host Brooklyn on Friday.


More AP NBA: https://apnews.com/tag/NBAbasketball