CHAPEL HILL, N.C. -- Because it had to dig a little deeper to fend off an upset-minded opponent, No. 12 North Carolina found some satisfaction in Tuesday night's game.

"Every night, it doesn't matter who you play," North Carolina forward Isaiah Hicks said. "You have to be tough down at the end. We got the stops we needed."

Justin Jackson scored 20 points as North Carolina had a hard time putting away Pittsburgh before winning 80-78 at the Smith Center.

The matchup between first- and last-place teams in the Atlantic Coast Conference came down to the final seconds, though North Carolina led for the last 16 minutes.

"We've just got to get better defensively," Tar Heels guard Joel Berry said. "But they came out and competed, and that's what you've got to expect in a conference like this."

Pittsburgh's Jamel Artis was way off the mark on a shot from about 30 feet that would have won the game at the buzzer.

Berry added 19 points, Hicks had 18 and Kennedy Meeks supplied 10 for the first-place Tar Heels (20-4, 8-2 ACC). North Carolina was coming off its lone January loss, a Saturday setback at Miami.

"For us, our goal is to win the conference, and (this helps)," Jackson said. "We really wanted to bounce back better than that."

Cameron Johnson matched a career-high 24 points for Pittsburgh, which lost its seventh game in a row.

Michael Young's 19 points, Artis' 15 points and Chris Jones' 12 points also helped the Panthers (12-10, 1-8). Artis and Young ranked first and second, respectively, in ACC scoring entering the game. It was the first time this season that one of that duo wasn't the team's top scorer.

"I think under the circumstances, they gave a terrific effort," Pittsburgh coach Kevin Stallings said of his players. "I'm proud of how they hung in there and kept the game close."

Pittsburgh shot 55.6 percent from the field. North Carolina was at 50 percent.

"Nobody plays Carolina and doesn't have breakdowns of some kind," Stallings said, figuring holding the Tar Heels to 80 points was an accomplishment of some sort.

Johnson's 3-pointer made it 49-49 with 16 1/2 minutes to play. Berry countered with a 3-pointer, bringing the crowd to life and igniting what became an 11-2 run across the next 4 1/2 minutes.

Pittsburgh endured an 11-minute stretch with only 10 points, but Young's back-to-back 3-pointers trimmed the deficit to 68-65 with 4:45 to play.

The Tar Heels scored the next three points at the free-throw line before another Johnson 3-pointer. On the next possession, Young missed a potential tying trey, but Artis' baseline jumper made it 71-70.

Berry answered with a three-point play with 1:38 left. Artis then hit a 3-pointer.

Jackson's drive made it 76-73, and then Meeks blocked Artis' shot from the lane. North Carolina's Nate Britt converted two foul shots at the other end with 33.1 seconds to go for a 78-73 edge.

Jones' corner 3-pointer gave Pittsburgh a chance. Jackson made 1 of 2 free throws at the 9.7-second mark, but North Carolina chose to foul rather than allowing a potential tying shot.

The move nearly backfired because after two Pittsburgh foul shots, Hicks made only the second of two attempts. Artis' off-balance attempt at a victory from the deep right wing wasn't close.

The Tar Heels made only five of their last nine free-throw attempts.

"We didn't make as many tonight as I wanted to," North Carolina coach Roy Williams said. "We gave up four or five points (with missed free throws)."

North Carolina held a 42-36 halftime lead, scoring at the buzzer on Luke Maye's basket off a rebound.

Both teams shot better than 53 percent in the first half even though they combined on 9-for-29 shooting on 3-pointers.

Pittsburgh had pulled even at 20-20 with nine minutes left in the first half.

Berry, who was without a field goal in eight attempts Saturday at Miami, drained a 3-point basket on the game's first possession.

NOTES: North Carolina is 4-2 against Pittsburgh since the Panthers joined the ACC. The teams meet again Feb. 25 at Pittsburgh. ... First-year Pittsburgh coach Kevin Stallings is one of five former Roy Williams assistants to have a team face one of Williams' squads. ... North Carolina G Theo Pinson missed his second game in a row after sustaining an ankle injury last week against Virginia Tech. ... Pittsburgh, averaging a league-high 8.9 baskets from 3-point range in ACC games, hit 10 in the second half and 13 in the game Tuesday. ... Pittsburgh is back in the area for a Saturday afternoon game at No. 21 Duke. ... North Carolina is home Saturday night against No. 20 Notre Dame.