Maryland men’s basketball coach Mark Turgeon urged guard Melo Trimble to drive to the basket with six seconds left and Saturday’s game against Michigan State tied at 60. If the defense collapsed on the junior star, Turgeon stressed passing the ball out to an open teammate.

“I kind of blocked that out,” Trimble remembers thinking, “and said ‘Shoot a three.”

With 2.7 seconds to play, Trimble pulled up from the left wing. At 2.3 seconds, the ball left his fingertips. As it glided through the air, Trimble stood with his feet planted, arms at his sides, eyes locked on the basket. He then watched the ball swish through the net with 1.1 seconds left, the final points in a 63-60 home win to close the regular season.

After yet another final-moment bucket, Trimble turned left toward one of the student sections and tugged his jersey where “Maryland” was emblazoned across his chest. Guard Kevin Huerter embraced him, so overjoyed he spun him to the floor, where he lay facedown to the cheers of the Xfinity Center crowd.

Trimble hoped the game was over, but the referees consulted replay and determined 1.1 seconds remained. The decision halted Maryland’s celebration, but the crowd returned to its raucous state when Michigan State’s last-ditch 3-pointer clanged off the rim.

“I told every referee that they were going to foul Melo,” Turgeon said. “Then he pulls up and makes the three.”

Trimble’s heroics ensured Maryland (24-7, 12-6 Big Ten) entered the postseason on a two-game winning streak after dropping five of seven contests. The Terps will be the No. 3 seed in next week’s Big Ten tournament, where they’ll have a double bye and won’t play until Friday night in the quarterfinals.

“We feel great,” Trimble said. “This one just gave us confidence and we feel relieved now. Back to 0-0.”

Despite shooting 6-for-15, Trimble led Maryland with 16 points and added six rebounds. On a subpar shooting day — the Terps went 42 percent from the field and even worse from beyond the arc (32 percent) — they received 15 points from forward Justin Jackson and 11 from guard Anthony Cowan.

Michigan State (18-13, 10-8) kept pace thanks to forwards Nick Ward and Miles Bridges, who scored 22 and 18 points, respectively.

Bridges’ 11 points helped the Spartans hold a 28-27 advantage after the first half, which proved to be an offensive struggle. In a slow-paced opening 20 minutes, the teams shot worse than 40 percent from the field. Michigan State, however, drained six triples on 12 attempts, while Maryland struggled from beyond the arc but held a six-point advantage at the foul line. The lackluster play kept the Xfinity Center crowd silent for much of the period.

The first few minutes of the second half warranted a larger ovation, as Maryland entered the under-16 media timeout on a 9-2 run to take a five-point lead.

Still, Turgeon wanted to fire up the Xfinity Center crowd. So he passed by his players as they started to gather for the break. He walked onto the court, stared at the fans clad in white, red, black and yellow, and raised his hands over and over again.

He needed the Maryland faithful to be louder as its team attempted to close the regular season with a victory.

“To say I wanted to win this one bad would be an understatement,” Turgeon said. “I wanted everyone to remember when they left this building [Saturday] that we had a heck of a team and that we have a lot of fun in this building.”

The noise level heightened after Trimble drilled a 3-pointer to put the Terps up, 43-35, out of the timeout, but Turgeon’s group scored two points over the next three-and-a-half minutes. Michigan State, meanwhile, scored nine points to take a one-point lead midway through the period.

Three times, the Terps opened a lead only to have Michigan State tie it. The third came at the 3;11 mark when Ward’s layup knotted the score at 60. That’s when the Spartans’ game-ending scoring drought started.

Ward had a point-black look to put Michigan State ahead in the final moments, but he fumbled the ball out of bounds. Six seconds remained on the clock.

For Trimble, that was more than enough time to hit another game-winner.

“A great player made a great play,” Izzo said.