NEW YORK (AP) Maryland looked like a team intent on a runaway victory, going up by 20 points in the first half and leading by 16 at halftime.

But the sixth-ranked Terrapins had to find a way to hold off a big rally by Connecticut before finally prevailing 76-66 on Monday night in the Jimmy V Classic at Madison Square Garden.

''We were as good as we've been all year on defense and with our rebounding,'' Maryland coach Mark Turgeon said. ''I'm glad it got close. We will learn more from that situation.''

More from FoxSports

Melo Trimble scored a season-high 25 points and freshman Diamond Stone had 16 for the Terrapins (8-1), who used their size up front to dominate the rebounding, 45-24, including 23-9 on the offensive end. Robert Carter had 11 rebounds and Stone grabbed nine for the Terps.

''I was really proud of his defense in the first half. In the second half it wasn't that good,'' Turgeon said of Stone, a highly recruited freshman. ''The bigger the lights the better he plays. He's coming and it helps that he has a lot of veteran bigs around him.''

Daniel Hamilton had a season-high 23 points for the Huskies (5-3), who have lost three of four.

''Once again getting down by 20 really hurt us,'' Connecticut coach Kevin Ollie said. ''The rebounding, the toughness. They have a talented team but they were tougher than us in every aspect. Trimble took more free throws than our entire team (15-12). They had 45 rebounds. ... We just have to continue to fight. It's a pattern we have to stop.''

Maryland took its biggest lead of the game at 34-14 on a 3-pointer by Jared Nickens with 4:54 left in the first half. The Terrapins led 38-22 at halftime, outrebounding the Huskies 25-12.

Connecticut had one last rush and the Huskies got within 67-64 when Hamilton capped a 16-5 run with a 3-pointer with 2:49 to play.

As Maryland inbounded the ball after the 3-pointer, a foul was called on Connecticut's Jalen Adams and Ollie was charged with a technical foul for his reaction to the call, one that sent papers flying through the air.

Trimble made three of the free throws and Rasheed Sulaimon followed a miss by Hamilton with a nice move inside and the lead was 72-64 with 2:06 to play.

''I hit the stand where the stats are and there were some there and I slapped that and papers went flying,'' Ollie said. ''I don't think it changed the momentum. He was going to the free throw line anyway so it would be either five or six.''

Turgeon said the technical ''helped us stem the tide a little bit.''

Sterling Gibbs and Shonn Miller each had 12 points for Connecticut and Rodney Purvis had 11, eight in the 16-5 spurt that made it close.

TIP-INS:

Connecticut: This was the Huskies' second appearance in the Jimmy V Classic. They lost to North Carolina State in 2012. ... Connecticut leads the all-time series with Maryland 4-3. ... The Huskies have a record of 61-53 at Madison Square Garden.

Maryland: The Terrapins are 12-6 all-time at The Garden. ... Maryland came into the game shooting 54.5 percent from the field and 39.8 percent from 3-point range.

UP NEXT:

Connecticut hosts Ohio State on Saturday.

Maryland hosts Maryland-Eastern Shore on Saturday.