CARY, N.C. - In a game in which second-seeded North Carolina saw arguably longer stretches of possession, the seventh-seeded University of Notre Dame men's soccer team answered with better quality on offense. A lockdown defensive performance against one of the top attacks in the nation, and timely goals from seniors Blake Townes and Jon Gallagher, were the recipe in leading the Irish over the No. 3 Tar Heels 2-1 on Sunday in a quarterfinal of the Atlantic Coast Conference (ACC) Championship at WakeMed Soccer Park.

No. 21 Notre Dame (11-5-2) advances to the semifinal round of the ACC Championship on Wednesday, traveling to sixth-seeded No. 16 Virginia (11-3-4) for a 7 p.m. (ET) start at Klockner Stadium in Charlottesville. Coverage will be available on ACC Network Extra.

MORE: Virginia advances to ACC semifinals after penalty kick shootout with Louisville

North Carolina (14-3-1) finished the contest with a 12-7 edge in total shots, but Notre Dame controlled the shots on goal count by a 4-3 margin. The Irish held North Carolina to five total attempts in the second half, on their way to outshooting the Tar Heels 6-5 in the frame.

In the early going North Carolina may have had the best of the ball, but Notre Dame struck decisively on one of its first trips up the pitch in the sixth minute. Sean Dedrick dropped a through pass for Thomas Ueland on the right flank. Ueland sent a perfect pass in the air to Blake Townesnear the right post, and a Townes header found its way past Tar Heel goalkeeper James Pyle. Townes' second goal of the tournament, and season, made it 1-0 Irish at 5:12.

North Carolina continued to press, and in the 15th minute had its best chance of the opening half to equalize. Jelani Pieters settled the ball right in front of the Notre Dame goal, but Chris Hubbard stood tall in his frame and snared the attempt out of the air for a great save.

The Notre Dame defense would not allow a single shot on goal the remainder of the opening 45 minutes, blocking a pair of North Carolina tries in the process. A Tar Heel corner kick in the 43rd minute was the final surge for the home side, and the Irish took a 1-0 lead to the locker room.

Notre Dame became the better team early in the second half, and began to control possession for long stretches not seen in its previous three periods against North Carolina this season. The Irish attempted the first shot of the half by either team in the 63rd minute, but a Kyle Dedrick try was blocked aside.

Hubbard and the Notre Dame defense continued to stand tall, as the Irish goalkeeper knocked aside a Jack Skahan shot at the left post in the 66th minute to quiet a North Carolina drive toward net. Two successive corner kicks for the Tar Heels came up empty.

MORE: Ohio State upsets No. 8 Michigan State to advance to Big Ten semifinals

With North Carolina pressing for the equalizer, Notre Dame pounced on the opportunity on its attack in the 78th minute. Building possession down the left flank, Felicien Dumas sent a looping cross over the field that looked destined to carry out of play. It did pick out Jeff Farina near the end line at the right post, and a Farina flick out front was met by the head of Jon Gallagher. Gallagher buried his 12th goal of the season on one of the best Notre Dame scoring sequences of the year, and the Irish claimed a 2-0 advantage at 77:24.

Gallagher nearly found another insurance goal in both the 83rd and 84th minutes, with his first chance just wide of the left post and the second shot ringing off the bar after being clipped by North Carolina keeper Pyle. A lunging Pyle save on a well-placed Gallagher shot in the 87th minute kept Notre Dame from adding its third goal.

North Carolina managed to find the scoreboard in the 87th minute, when Alan Winn connected from Zach Wright on his 10th goal of the season to trim the deficit to 2-1 at 86:53. Notre Dame held firm on defense for the final three minutes, and a Hail Mary shot from Cam Lindley at the buzzer for the Tar Heels went begging.