COLLEGE PARK, Md. (AP) There was no panic by Maryland coach Mark Turgeon or his players after the Terrapins suffered a pair of Big Ten losses last week.
Turgeon was confident his team has enough talent and depth to overcome that type of adversity.
It proved to be the correct assessment as Maryland responded with one of its most hard-fought performances of the season.
Robert Carter scored 17 points and the sixth-ranked Terrapins toppled Michigan 86-82 on Sunday.
''It's great to win and it is great to play well,'' Turgeon said. ''You lose two in a row, it felt like two months. I was really proud of our team. We beat a really good team that plays really, really well in Michigan.''
Jake Layman had 16 points, while Melo Trimble finished with 13 for Maryland (23-5, 11-4 Big Ten). Freshman Diamond Stone added 13 points after being suspended for the previous game for a flagrant foul against Wisconsin.
Junior Mark Donnal went 10 of 13 from the field and had 25 points for Michigan (19-9, 9-6).
Muhammad-Ali Abdur-Rahkman had 16 points, Derrick Walton Jr. scored 14 and Zak Irvin had 11 points for the Wolverines.
A careless inbound pass by Carter was stolen by Abdur-Rahkman, who made an uncontested layup and tied the game at 47 three minutes into the second half.
Maryland retook control as Layman got going. The senior made a pair of 3-pointers and the Terrapins led 66-58 with 12 minutes remaining.
''They're definitely an NCAA Tournament team,'' Layman said about Michigan. ''I think it was a good win for us especially in the league. I think going forward it's going to help us.''
Donnal responded with six straight points and the Wolverines trailed 72-70, forcing Maryland to call timeout with 7:08 left. After another Terrapins' turnover on the ensuing possession, Michigan retook the lead on a layup and free throw by Abdur-Rahkman.
The Terrapins continued to battle through their mistakes. A dunk and layup by Carter provided a 78-75 lead with 3:29 remaining.
From there, the Terrapins held on. Walton pushed off and fouled out with 18 seconds left, ending a key possession.
Rasheed Sulaimon then made free throws before Duncan Robinson (10 points) answered with a 3-pointer to pull Michigan within 84-82 with 7 seconds left.
Trimble, though, made two free throws in the final seconds to seal the game.
''We battled back and had to do it again in the second half,'' Michigan coach John Beilein said. ''We just didn't have enough to get it done. Tough breaks down the stretch. The ball didn't bounce our way a couple of times.''
Michigan won the prior matchup 70-67 on Jan. 12. This time, the Terrapins were in control early before the Wolverines took advantage of turnovers to get back in the game.
A 3-pointer and layup by Jaylen Brantley capped a 14-0 run and Maryland led 26-12 midway through the first half. Michigan was held without field goal for just over seven minutes before Walton converted a layup with 7:04 remaining.
The Wolverines, however, tightened their defense and a 3-pointer by Donnal cut the margin to 35-30 during an 11-0 run. Michigan scored 15 points off 12 Maryland turnovers and trailed 41-36 at the break.
Michigan: Caris LeVert missed his second consecutive game with a lower left leg injury. He has missed 13 games this season and the Wolverines are 7-6 without him in the lineup.
Maryland: Melo Trimble entered the game having made just seven of his past 38 field-goal attempts (18.4 percent). The sophomore went 3 of 10 from the field and had seven turnovers against the Wolverines.
Maryland guard Rasheed Sulaimon finished with eight points, snapping a streak of five consecutive games of scoring in double figures. Still, Sulaimon made a pair of key free throws down the stretch and was effective setting the offense.
Michigan was 13 of 27 from beyond the arc, It was the 18th game this season the Wolverines have made 10 or more 3-pointers.
Michigan hosts Northwestern on Wednesday.
Maryland travels to No. 17 Purdue on Saturday.