Starting for the injured Jimmy Butler, Martin shot 9 of 12 from the field, including 6 for 8 on three-pointers, as the Heat tied a franchise record with 22 threes against the defending NBA champions.
Kyle Lowry had 22 points and 13 assists and Max Strus scored all 16 of his points in the fourth quarter for Miami, which snapped a three-game home losing streak.
The Heat took the lead for good with nine straight points in the final 55 seconds of the third. Consecutive three-pointers from Lowry and P.J. Tucker's three at the buzzer put Miami ahead 83-77. Tucker finished with 13 points.
Butler, the Heat's leading scorer, aggravated an injury in Monday's loss to Memphis. He had missed the previous four games because of a bruised tailbone.
Bucks: G George Hill (right knee hyperextension) missed his third consecutive game. ... Antetokounmpo blocked a shot and moved within one of Alton Lister, the club's career leader at 804. ... Middleton had his sixth straight game of 20 or more points. Milwaukee is 7-2 when he reaches 20 points.
Heat: The 51-44 halftime deficit was Miami's first under double digits in its last three home games. ... G Duncan Robinson played in his 173rd consecutive game, one behind Glen Rice for most in club history. Robinson began the streak on April 9, 2019.
Heat center Bam Adebayo is expected to miss between four and six weeks after undergoing surgery on his right thumb to repair a torn ligament Monday in Los Angeles. Adebayo sustained the injury in the home loss against Denver.
The Bucks and Heat already have played three times in their first 26 games. Neither team has faced another opponent more than twice. Their fourth and final regular-season meeting is March 2 at Milwaukee.
Bucks: Continue their four-game road trip Friday at Houston.
Heat: Conclude a three-game homestand against Chicago on Saturday.