DURHAM, N.C. -- Cody Stubbs singled home the go-ahead run in the top of the 18th inning and North Carolina advanced to the Atlantic Coast Conference title game by beating rival North Carolina State 2-1 early Sunday morning.

The top-seeded Tar Heels (51-8) will face Virginia Tech at 1 p.m. Sunday -- nearly 11 hours after winning the longest game in ACC tournament history. It will go down as the longest game played by a UNC team and for the second consecutive year the UNC-NC State ACC Tournament game set a new state of North Carolina record for collegiate baseball attendance as 11,392 fans saw the longest game in ACC Tournament history.

Landon Lassiter walked to start the 18th, moved to second when Colin Moran was hit by a pitch from Chris Overman (1-1) and advanced to third on Skye Bolt's bunt.

Stubbs then singled to short left field off Will Gilbert to bring home Lassiter.

Chris Munnelly (6-0) gave up a leadoff double to Brett Williams before getting two popouts and a groundout to end it at 1:52 a.m. ET.

Carlos Rodon threw 10 innings of one-hit ball with 14 strikeouts for third-seeded N.C. State (44-14).

The two teams combined to strike out the second-most batters ever in an NCAA game as four UNC pitchers struck out 21 batters, while six NC State pitchers combined to strike out 22 Tar Heels in the marathon contest.