NEW YORK (AP) Dwyane Wade missed the Heat's previous seven games. The Knicks would have liked him to miss at least one more.
Wade returned from a hamstring injury to score 27 points - 13 in the fourth quarter -and Miami beat New York 86-79 on Sunday night.
''For me, the fourth quarter is the only one where I can be selfish,'' Wade said.
Chris Bosh added 20 for the Heat, including a crucial 3-pointer with 1:07 left as Miami held off a late New York rally.
Carmelo Anthony also returned after a two-game absence because of back spasms to score 31 points for the Knicks.
''If I can go, I can go,'' Anthony said. ''That was my mindset. If I feel like I can play, I am going to give it a shot.''
Amare Stoudemire had 19 points and 12 rebounds for New York.
''At this point I think we just got to look ourselves in the mirror and see if we're putting forth the effort that we need to win,'' Stoudemire said. ''We got to take it upon ourselves to see if we're getting ourselves prepared for the game or having the right mentality to play a game at a high level.''
After trailing by as many as 16, the Knicks pulled to 65-63 on Tim Hardaway Jr.'s layup with 9:22 left.
Wade followed with a baseline jumper and scored 12 of Miami's next 15 points to help the Heat maintain the lead.
''I played 32 minutes, but it felt a lot more like 50,'' said Wade, who added five assists. ''It took a while. Early on I was just trying to make plays for my teammates.''
After the Knicks again pulled to 79-77 on Stoudemire's tip-in with 1:23 left, Bosh hit his 3-pointer and New York never got closer.
''When the situation gets a little tense, a little tight, we need a shot and we run plays that we normally get good looks off of and it was just about having your feet set and shooting with confidence,'' Bosh said.
The Heat opened a 10-2 lead and never relinquished the advantage.
Miami took its biggest lead, 37-21, on Bosh's layup with 4:48 remaining in the first half. The Heat had led 21-17 after the first quarter before beginning the second on a 16-4 run.
Luol Deng had 10 points and 10 rebounds for the Heat. Bosh added nine rebounds.
Samuel Dalembert and Jose Calderon each had 10 rebounds for the Knicks.
Heat: Miami has beaten the Knicks four straight. ... Bosh (4th) and Wade (5th) were selected directly behind Anthony (3rd) in the 2003 draft. ... The Heat were 3-4 during Wade's seven-game absence.
Knicks: New York last beat Miami on Jan. 9, 2014. Anthony had 29 points, eight rebounds, five assists and two steals in that 102-92 victory. ... New York has lost four straight, six of its last seven and 13 of its last 15. ... The Knicks' 34 halftime points were one more than the season-low 33 they scored in their previous game against Oklahoma City on Friday night.
The Heat scored the first four points of the game and held at least a two-point lead for the entire 48 minutes.
Heat: At Washington on Monday night.
Knicks: Hosts Brooklyn at Tuesday night.