“I watched the film, I was just so impressed with our defense, it was amazing,” said Maryland Coach Mark Turgeon of his team’s performance against North Carolina State. (Patrick Semansky/AP)

When opponents scout this Maryland basketball team, Terrapins Coach Mark Turgeon wants them to think defense. So after reviewing Maryland’s 51-50 upset of No. 14 North Carolina State on Wednesday, just two words came to mind.

Holy smokes.

“That was high-level defense for 40 minutes,” Turgeon said Friday.

Alex Len’s buzzer-beating tip-in caused the sellout crowd to storm the Comcast Center floor, but a stellar defensive sequence gave the Terrapins the opportunity to secure arguably their biggest win since 2010. The Wolfpack, which entered ranked first in the ACC in both points per game and field goal percentage, had possession with 1 minute 14 seconds left and a one-point lead, trying to bleed the clock and secure a win.

North Carolina State idled around the perimeter until Scott Wood hoisted an off-balance three-pointer with five seconds remaining on the shot clock. It banged off the back iron, and Richard Howell snagged the offensive rebound over James Padgett. So the Wolfpack stalled some more. Wood sprung free for a baseline jumper and again hit the back iron. Padgett grabbed the rebound, got fouled and set up Len’s late heroics.

And the only time the Terps properly executed after a timeout, Turgeon said, came when Len swatted away Wood’s long inbounds pass with 0.9 of a second left, sparking the raucous celebration by midcourt.

“So we weren’t 0-for-timeouts,” Turgeon said. “We got one right.”

Maryland (14-3, 2-2) still ranks second in the ACC in shooting percentage but has made just 32.7 percent of its attempts over the past five halves. But as the Terps’ offense struggles to discover consistency, at times missing open jumpers and failing to execute set pieces, their defense has never been better.

“I watched the film, I was just so impressed with our defense, it was amazing,” Turgeon said. “For having such a new team and so many young guys to guard that way against so much talent, and I know it was a hostile environment for them. . . . I felt Florida State got a lot of open looks. Miami got fewer and North Carolina State got even fewer open looks.”

The difference, Turgeon said, stem from rotation. Guards are hedging harder rather than leaning on Len as a back-line rim protector. Only when North Carolina State switched to zone, baffling Maryland’s offense and forcing rushed attempts, did the defense break down in response.

And so the Terrapins — who have mustered just 36 total first-half points over the past two games — are well equipped to weather brutal shooting stretches. More so than in Turgeon’s debut season in College Park, the players say, Maryland has developed a team identity defensively.

“The guards, we’re playing better team defense,” freshman Seth Allen said. “We’re doing a lot of little things, like jabbing at a defender when he’s rotating just to help the rotating guy or help the helper. It shows. In high school, defense isn’t how it is here. It’s not as intense. On defense we try to take care of every possession, try to contest a shot every possession.”

Said sophomore guard Nick Faust: “I think we’re doing a pretty good job. Usually for teams, if their offense isn’t flowing it affects their defense. But for us, we’re doing a great job of pushing through that and defending.”

Now the Terps face a different challenge in North Carolina (11-5, 1-2), which is stocked with six guards who will stretch Maryland’s defense. P.J. Hairston had a game-high 23 points off the bench in a 77-72 win over Florida State last Saturday, and junior Reggie Bullock leads the league in three-point percentage. Hairston ranks seventh.

The lid may disappear from Maryland’s basket soon, the offense returning to its pre-ACC shape featuring unselfish passing and inside-out principles to create open shots. But until that time arrives, the Terps are comfortable being identified as defense-first.

“There’s no let-up when we sub defensively,” Turgeon said. “I think right now, that’s what we’re hanging out hat on.”