RALEIGH, N.C. (AP) - Three days after squandering an 18-point lead with 13 minutes remaining, North Carolina State was in nearly the same position again.

This time, they held on for the win.

Brandon Costner scored 23 points, including 11 in a row early in the second half, to help the Wolfpack defeat No. 7 Wake Forest 82-76 on Wednesday night.

Farnold Degand tied a career high with 14 points, and Courtney Fells and Tracy Smith added 12 points apiece for N.C. State (13-9, 3-6 Atlantic Coast Conference), which watched a 20-point second half lead shrink to two in the final minute.

C.J. Williams added a career-high 10 points for the Wolfpack, who led at Virginia Tech 63-45 on Sunday before falling in overtime, 91-87.

"We've been in situations where we were in control of the game or had a game and didn't finish it off," N.C. State coach Sidney Lowe said. "But these guys realize that they've been in that position before. The difference between winning and losing is whether you're going to make the right plays down the stretch, and tonight we did that."

N.C. State students stormed the court after the clock expired in Wake Forest's third consecutive road loss. The Demon Deacons (18-4, 5-4 ACC) have lost four of six games since starting the season 16-0 and earning the nation's No. 1 ranking.

"We have to realize that everyone is gunning for us," said Wake Forest guard Jeff Teague, who scored 11 points. "We came out lackadaisical. We think we're Wake Forest and everyone is going to lay down for us. When we start realizing that they're not, we'll get back to winning."

The Demon Deacons, who trailed 42-34 at halftime, nearly figured it out in time against the Wolfpack.

James Johnson, who scored 18 points to lead Wake Forest, cut N.C. State's lead to 78-76 with a 3-pointer from the top of the key with a minute remaining. The Demon Deacons got the ball back after Ben McCauley made 1 of 2 free throws, but Johnson missed a 3-pointer that would have tied the game with 40 seconds to play.

The Wolfpack were 4-for-6 on free throws from that point to seal the game.

Johnson turned into Wake Forest's go-to player because Al-Farouq Aminu fouled out with 11:58 to play and Teague, the ACC's second-leading scorer, was locked up by N.C. State's box-and-one defense. Teague attempted just one shot in the first half, a deep 3-pointer to beat the shot clock, and did not make a field goal until he banked in a short jumper in transition with 15:52 remaining in the game.

Wake Forest coach Dino Gaudio said he expected the Wolfpack to use the junk defense, but Teague and his teammates did not respond well to it after practicing against it for two days.

"He was standing around a lot," Degand said of Teague, who finished just 2-for-3 from the field. "I think that definitely took them out of their offense and helped us out a lot."

So did Costner's scoring.

Costner, who made his first five shots of the second half, turned N.C. State's 51-42 lead with 15 1/2 minutes remaining into a 62-42 cushion less than two minutes later. He made a pair of 3-pointers, converted a three-point play and sank a pair of free throws during that stretch.

"Opportunities came my way, and I tried to take advantage and build on the lead," Costner said. "I tried to get everybody fired up so that we could push for as big of a lead as we could build."

On the rare occasion when Costner missed, Smith was there to chase down the ball. He finished with 12 rebounds, including 10 on the offensive glass, as the Wolfpack beat Wake Forest 39-35 on the boards.

The Demon Deacons shot 50 percent from the field, but they couldn't overcome 17 turnovers and N.C. State's 17 offensive rebounds. At one point during Wake Forest's run, Smith rebounded his own missed free throw and laid the ball in the basket.

"We had two instances where we didn't block out on a free throw, which is inexcusable," Gaudio said. "One time, we didn't box out the shooter on a free throw. You learn to do that in the third grade."