BROOKLYN, New York — Coach Mark Turgeon couldn’t watch his Maryland men’s basketball team with less than six minutes left in the first half against Richmond Friday night.

The Terps faced a 12-point deficit against the middling Atlantic 10 program, and forward Justin Jackson had just committed an offensive foul. Turgeon, who was already squatting in front of the Maryland bench, put his hands down and lowered his head inches from the court. It was as if he couldn’t believe his team’s struggles.

A 1-for-13 performance from beyond the arc helped put Maryland in a 12-point halftime hole, but Turgeon’s bunch found its stroke from deep after the break. The Terps made nine of their 18 3-pointers in the second 20 minutes and overtime, shots that helped Maryland pull out an 88-82 overtime win and avoid another upset early in the season.

Still undefeated, Maryland will play Kansas State in the final of the Barclays Center Classic on Saturday night.

Guard Melo Trimble, who finished 5-for-13 from three-point range, led all scorers with 31 points. Freshman guards Kevin Huerter (12) and Anthony Cowan (18) and Justin Jackson (16) joined Trimble in double figures. Forward T.J. Cline paced Richmond with 18 points, nine rebounds and nine assists.

While three-point baskets from Trimble and Huerter spearheaded the Terps’ comeback — one of Trimble’s threes tied the game at 47 with less than 12 minutes to play — Richmond (3-2) kept pace down the stretch. Down 60-58, the Spiders scored five straight points to retake the lead. Turgeon responded by calling a timeout just before the final media break.

Cline then nailed a 3-pointer, erasing Richmond’s two-point deficit with about 31 seconds left, but Jackson went to the line on the ensuing possession and split a pair of free throws to tie the game. While both teams had chances to win in the final moments, neither managed a good look at the basket. Maryland turned the ball over on the inbounds pass and Richmond missed a contested three.

Trimble and Jackson, however, swished 3-pointers in the extra period, providing a cushion the Terps (6-0) wouldn’t relinquish en route to their sixth straight win of the season.

Richmond, which entered the game shooting 35.4 percent from beyond the arc, made six of its 11 attempts before intermission. When the Spiders were beating the Terps from deep, guards ShawnDre’ Jones and Khwan Fore found success getting into the lane. Jones, Richmond’s top scorer, led with 13 points at half. Jones added eight points on 4 of 8 shooting.

But Trimble overtook Jones as the game’s leading scorer in the second half and overtime, finishing 10-for-20 from the field. His 30th point came on the foul line with less than five seconds to go, securing Maryland’s advancement to Saturday’s championship against Kansas State.