RALEIGH, N.C. (AP) — Jamie Newman threw a 32-yard touchdown pass to Jack Freudenthal with 30 seconds left to give Wake Forest a 27-23 upset victory over No. 22 North Carolina State on Thursday night.

Making his first career start, Newman was 22 of 33 for 297 yards with three touchdown passes in the second half to help the Demon Deacons (5-5, 2-4 Atlantic Coast Conference) rally from a 10-point deficit in the fourth quarter. The 19.5-point underdogs earned their first road victory over a Top 25 team in a decade.

"This was going to be a game that we just have to grind, and grind, and grind, and somehow find a way to win," coach Dave Clawson said. "And to our kids' credit, they did it. Every time that that thing was on the brink of getting away from us, we just did one thing to stay in it."

Newman threw a 38-yard scoring pass to Alex Bachman before his 19-yard TD to Greg Dortch pulled Wake Forest to 23-20 with 6:07 left.

N.C. State bled nearly 4 1/2 minutes off the clock before its drive stalled at the Wake Forest 20 with 1:39 left. Newman completed 5 of 8 passes on the possession that followed, taking a hit as he connected with a wide-open Freudenthal over the middle for the go-ahead score.

The Wolfpack advanced to their own 49 before Ryan Finley's final pass for the end zone was intercepted by receiver Scottie Washington — playing defensive back on the last play — to end it.

Finley finished 35 of 52 for 374 yards with a 35-yard touchdown pass to Emeka Emezie and a 2-yard touchdown run for the Wolfpack (6-3, 3-3, No. 14 CFP). They have lost three of four.

THE TAKEAWAY

Wake Forest: Maybe a third straight bowl berth isn't out of the question for the Demon Deacons, who hadn't beaten a nationally ranked opponent on its home field since knocking off No. 24 Florida State in 2008 and had won in Raleigh only once in their previous 16 tries. This didn't look at all like the same Wake Forest team that was routed by No. 3 Notre Dame and No. 2 Clemson.

N.C. State: This one is going to sting the Wolfpack, who settled for three short field goals after drives stalled deep inside the red zone. They also finished with 47 yards rushing against the ACC's worst run defense, and on a drive that was supposed to bleed the clock, they rushed for minus-6 yards on three carries while relying on Finley's throwing.

"I take responsibility any time my team doesn't play the way that it can, and I do," coach Dave Doeren said. "We had a lot of opportunities, and there (are) a lot of things that happened throughout the course of the game that led to the result."

UP NEXT

Wake Forest: Returns home to play host to Coastal Division leader Pittsburgh on Nov. 17.

N.C. State: Visits Louisville on Nov. 17.

___

More AP college football: https://apnews.com/Collegefootball and https://twitter.com/AP_Top25

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.