By the time Mark Turgeon plopped down behind three microphones for his postgame news conference Tuesday night, he had long since removed his suit jacket. Forty minutes of heart-pounding stress can have that effect. Yet the Maryland men’s basketball coach had a grin that lit up Coleman Coliseum, where his Terrapins got to book a season-ending trip.

“New York City,” a grinning Turgeon said as he left the media room after the Terrapins squeaked out a 58-57 win over Alabama in the National Invitation Tournament quarterfinals, shaking hands and repeating himself for emphasis. “New York City.”

As late-season losses torpedoed Maryland’s already slim NCAA tournament chances, reaching Madison Square Garden became the next best thing. The hallowed arena beckoned as the site of the NIT semifinals and finals. So before Tuesday’s tipoff, Turgeon took a dry-erase marker to a nearby white board.

“We talked about winning,” Turgeon said. “We did some things in pregame, talking about all the great players who have played in the Garden. Halftime, I talked about Frazier-Ali, Michael Jackson, different people who have been in the Garden. What an honor to be in that same building. So we tried to use that as motivation too. Then we said that playing in the Garden shouldn’t be easy. It should be really hard. We should have to earn it.”

One week separates Maryland from its NIT semifinal date against either Virginia or Iowa, who will face off Wednesday night in Charlottesville. But winning Tuesday in an arena where no visiting team had won since Dec. 30 represented another growing moment for a team that has come far in recent weeks.

Like Turgeon predicted, it wasn’t easy. Leading by six points and with possession, sophomore Dez Wells traveled twice, creaking open the door for Alabama. After Alex Len missed two free throws with a one-point lead, all signs pointed to another massive letdown, much like the one at Virginia that clinched their NIT fate.

A stuffed arena roared as Crimson Tide guard Rodney Cooper drove down the left side, turning the corner before Len swatted his shot out of bounds. With 3.8 seconds left, Alabama regained possession. Trevor Lacey shook free on a double screen, curling to the left elbow and receiving the pass. Nick Faust bit on a hard pump fake, and could only watch as Lacey’s mid-range jumper bounced twice off the rim before dropping to the hardwood.

“We knew they were going to make a run,” point guard Pe’Shon Howard said. “We knew they’d pick it up. It’s a win-or-go-home type of situation. We knew they were going to make plays and we matched it. That’s one of our things, just trying to grow up and withstand teams. We knew they were going to tough, but we wanted to be tougher.

Playing without Seth Allen, their third-leading scorer through five postseason games and a one-man energy drink off the bench who fractured his shooting hand during Sunday’s practice, the Terrapins committed 18 turnovers. Yet they somehow managed to end Alabama’s 12-game home winning streak, moving to 25-12, the program’s first 25-win season since 2006-07.

Len finished with 15 points, 13 rebounds and five blocks. Jake Layman had 13 points, including two three-pointers from atop the key that ballooned Maryland’s lead to eight points, creating enough comfort to withstand a late run. Even Howard, who had Allen jabbering in his ear all day to shoot, stuck what Turgeon called the game’s biggest shot, a three-pointer with 4 minutes 39 seconds left that made it 51-47.

Maryland opened its season at Brooklyn’s Barclays Center in a sluggish loss to Kentucky before reeling off 13 straight wins. Even with the Wildcats bounced from the NIT long ago, the Terps see their return as an opportunity for atonement.

“It’s not the NCAA, but NIT doesn’t sound too bad to me,” Wells said. “We’re just ready to try to make a good run at a championship. . . .We have a lot of unfinished business in New York.”