BLACKSBURG — Virginia Tech’s young football team grew up Saturday night.

The Hokies erased a 16-7 second-half deficit at Kenan Stadium to escape Chapel Hill with a 22-19 win over North Carolina.

Quarterback Ryan Willis threw a 1-yard touchdown pass to Dalton Keene with 19 seconds left to seal the victory against the Tar Heels after the Hokies allowed more than 200 yards rushing for the first time this season — including a series of explosive plays on the ground — and turned the ball over twice.

Virginia Tech (4-2, 3-0 ACC) still found a way to win the game.

Willis had the Hokies in position to take a lead at the end of the third quarter, but threw an interception trying to hit tight end Chris Cunningham at the goal line. Safety J.K. Britt picked the pass off.

He shrugged off the mistake — and an altogether frustrating night — orchestrating an 18-play, 98-yard game-winning scoring drive late in the fourth quarter. Willis completed passes of 29 yards to Damon Hazelton and 19 yards to Steven Peoples. The quarterback ran for a first down on a fourth-and-nine to extend the drive in the final two minutes and the offense also converted four third down attempts.

It was a big turnaround for Willis, who went into halftime with fewer passing yards (34) than North Carolina receiver Dazz Newsome. Newsome threw a 43-yard pass on a trick play in the second quarter.

Backup safety Tyree Rodgers set up the score by forcing a game-saving fumble at Virginia Tech’s 2-yard line. North Carolina looked like it was about to clinch a victory when Rodgers jarred the ball loose from Tar Heels running back Michael Carter.

North Carolina (1-3, 1-1 ACC) had its share of ups-and-downs, but running back Michael Carter was the lone consistent option for either offense up to that point, running the ball 18 times for 165 yards including three rushes of 25-plus yards.

The Tar Heels issues in the red zone prevented them from landing a knockout blow. They had to settle for field goal attempts on six for their seven trips inside the 20-yard line — Freeman Jones missed two of those attempts — and turned the ball over the last time.

North Carolina also turned the ball over on downs on a drive that ended at Virginia Tech’s 26-yard line.

The Tar Heels started true freshman quarterback Cade Fortin, but he suffered a right leg injury late in the second quarter and didn’t return. Nathan Elliott, who started the first four games of the season, finished out the game under center.

Elliott nearly put the game away with an 80-yard completion to Beau Corrales down to Virginia Tech’s 13-yard line midway through the fourth quarter. The throw came on a third and long with the Tar Heels backed up at their own end zone after three straight procedural penalties.

North Carolina got the ball down to the 1-yard line where Rogers forced the fumble.

Virginia Tech was fortunate to be in position for the comeback, going into halftime only trailing by a field goal — down 9-7. The Hokies managed only nine total yards in the second quarter with their only first down coming as they ran out the clock before the break.

Five of the 10 offensive plays Virginia Tech ran before its final drive of the second quarter went for negative yardage. Quarterback Willis was sacked three times during the stretch.

Luckily for the Hokies, the offensive struggles went both ways.

North Carolina made three trips inside the Hokies’ 30-yard line during the quarter and only came away with three points. The Tar Heels missed a field goal and turned it over on downs before Jones knocked through a 22-yarder with 49 seconds left in the half.

The Tar Heels made it inside Virginia Tech’s 10-yard line twice in the half, but settled for a field goal both times.

Virginia Tech got off to a promising start, forcing a fumble on North Carolina’s first play from scrimmage. The turnover gave the Hokies’ offense a short field at the 45-yard line. Safety Emmanuel Belmar popped the ball loose from Antonio Williams.

Willis scored on a 33-yard touchdown run four plays later. Willis faked a handoff to Peoples but kept the ball around the left side of the line.

After side-stepping a diving defender, Willis had the middle of the field all to himself giving Virginia Tech a 7-0 lead with 13:05 left in the first quarter.

North Carolina came into the game with the worst turnover margin in the country, but Virginia Tech also turned the ball over in the first quarter. Willis threw a strike to Hazelton that bounced off the receivers’ hands and chest and into the hands of defensive back Patrice Rene.

The turnover stopped a promising drive that was inside North Carolina’s 35-yard line.

North Carolina managed to cut into Virginia Tech’s lead in the first quarter with a pair of field goals. Carter set up the team’s first field goal, a 33-yarder from Jones, with the first of two 49-yard runs. It was the longest run of the season for the Tar Heels’ offense.

Jones knocked through a 30-yard field goal with 1:11 left in the first quarter to make it 7-6 after a holding call on North Carolina lineman Nick Polino wiped away a touchdown that would have given the Tar Heels a lead.