MIAMI -- Trailing entering the fourth quarter, that's becoming common for the Miami Heat.

So is overcoming those deficits.

Down by five entering the fourth, the Heat clamped down and beat the Toronto Raptors 102-97 Sunday night, getting 30 points from LeBron James and 17 from reserve Michael Beasley.

"We stayed with it mentally," Heat coach Erik Spoelstra said. "We were into the grind and staying the course and had to continue to make plays."

Playing in a back-to-back for the first time since mid-November, Dwyane Wade scored 14 points in 35 minutes for Miami, which got 11 rebounds from Chris Bosh and outscored the Raptors 23-13 in the final quarter.

Miami is 7-6 this season when trailing entering the fourth.

"Just find a way to win," James said. "Every game is different. One game is different is from the next and you just find a way to win when you can."

The way they won this one was defensively. The Heat shot only 7 for 20 in the fourth, but the Raptors shot 6 for 21.

"They got more aggressive," Toronto's Kyle Lowry said. "We weren't attacking as much in transition. First three quarters we were able to get out and run a little bit more. The quarter started very slow for us and it really hurt us."

DeMar DeRozan scored 26 points on 11-for-19 shooting for Toronto, which was bidding for its first six-game winning streak since April 2007. Amir Johnson and Jonas Valanciunas each scored 17 for the Raptors, who got 14 from Lowry.

Toronto had a slew of late chances. Johnson could have given the Raptors the lead with 25 seconds left, but his 4-footer bounced off the rim. And Lowry's 3-point attempt with Toronto down three with 6 seconds left also missed, with James corralling that rebound and sealing the win at the foul line.

"We couldn't get a bucket," DeRozan said. "Things were going our way and then it came down to LeBron hitting a couple of big shots."

A night after shooting 9 for 9 in Orlando, Bosh shot just 2 for 9, but his hook in the lane with 8:57 left put the Heat on top 86-84. Miami wouldn't trail again.

Miami was up 52-51 at the break, then quickly lost the lead and its point guard.

Mario Chalmers missed the second half with right Achilles' tendinitis. He played 15 minutes in the first half, roughly his usual workload, but Spoelstra said the team decided at halftime to shut him down. Chalmers wasn't sure what caused the issue.

While that was settling in, Toronto was taking off, a 12-2 run not long after halftime giving the Raptors a seven-point edge.

The margin was nine with 4:56 left in the third after an inside score by Valanciunas, who had 10 in the quarter. Miami ripped off nine straight to tie it, but Lowry -- who also made a pair of 3-pointers in the period -- closed the third with a jumper that put Toronto up 84-79.

"I like the way our guys fought, but in the NBA you don't get a win or any medal for losing," Raptors coach Dwane Casey said. "I like what our guys are building. I know where we are. I've said it. I haven't wavered from it. I like the direction we're going."

Without Chalmers, Roger Mason Jr. got just under six minutes of second-half playing time for the Heat, his only basket being a 3-pointer to start Miami's fourth-quarter rally. Unless the Heat decide to part ways, Mason Jr.'s contract becomes guaranteed for the remainder of the season on Tuesday.

So, too, does Beasley's deal. His 17 points came in just 20 minutes.

NOTES: Miami F Shane Battier (left quad strain) hoped to play Sunday but was inactive, along with C Greg Oden (knee rehab). F-C Tyler Hansbrough (sprained left ankle) was out for Toronto, only the seventh time the Raptors lost someone for a game because of injury this season. ... Instead of flying to Indianapolis after the game, the Raptors opted to stay another night in Miami because of the snow and extreme cold in the Midwest. Toronto plays at Indiana on Tuesday. ... It was James' 250th regular-season game with the Heat. He's reached double digits in scoring in every one.