BOSTON (AP) — North Carolina coach Roy Williams spent most of the second half of Tuesday night's game against Boston College in the locker room after collapsing to the court with vertigo.

When it was over, he decided to come back out — not just to congratulate his ninth-ranked Tar Heels on their come-from-behind 68-65 victory, but also to commend the Eagles and coach Jim Christian on their hard-fought loss.

"I really felt like it was important for me to come out and shake Jimmy's hand because I didn't want to be a distraction," said Williams, 65, who has suffered from benign positional vertigo for 17-18 years but said he never had it hit him during a game.

"I'm alive. I'm kicking," said the Hall of Fame coach, who was replaced on the bench by assistant Steve Robinson. "I couldn't be happier for Steve. He's like a brother to me and he coached his buns off tonight."

Justin Jackson scored 20 points, and Marcus Paige hit a 3-pointer with under 2 minutes left to give Carolina (20-4, 9-2 Atlantic Coast Conference) the lead for good. The Eagles, who have not won an ACC game this season, led the whole way until Theo Pinson hit two free throws with under 4 minutes remaining.

Dennis Clifford had 14 points and 13 rebounds, and Eli Carter scored 26 points for BC (7-17, 0-11). Matt Milon made a 3-pointer with 5.6 seconds left, but after Paige hit two free throws Carter's off-balance attempt from half court bounced harmlessly off the backboard.

With the victory, Carolina snapped a two-game losing streak — its longest of the season.

"We certainly rallied around the fact that Coach was down," said Robinson, who had been a head coach at Tulsa and Florida State. "Like I told them, it's not my first rodeo. Things just kind of worked out for us at the end. But we battled."

Jackson said the players weren't overly concerned because they had seen Williams have vertigo attacks before in practice.

"Not in a game, but we've seen it before and he's been fine after a little bit," he said. "It definitely stinks in the middle of a game to see your coach go down like that. But Coach never quits. So we know he'll be back."

Christian said it took him a minute to realize what had happened. But he was glad to see Williams after the game, shaking hands.

"For him to come back out and congratulate our kids on their effort speaks volumes as to why he's a Hall of Fame coach," Christian said. "He really wanted to congratulate them. And deservedly so. Anybody who saw this game today saw a lot of heart, a lot of character."

Clifford had six rebounds in the first 6 minutes to help BC open a 13-4 lead. The 7-foot senior, who has had only one double-double in his career, finished the first half with nine boards and eight points, then opened the second half with a dunk that he celebrated by flexing his arm at the BC bench.

Clifford added another dunk with 7:33 left to make it 56-49. This time, he threw it down with both hands, then flexed both arms as he ran back on defense.

But BC went cold, failing to score for almost 4 minutes while the Tar Heels ran off eight straight points to take their first lead of the game. With Carolina leading 57-56, Carter made one of two free throws to tie it and then, after Jackson hit a jumper in the lane, Carter made a 3-pointer to give the Eagles a 60-59 lead. It was their first basket in 5:24.

Paige hit a 3 with 1:47 left, and after BC couldn't get a shot off Jackson made a short jumper from the side to give Carolina a four-point lead. It was still four points when Milon made a 3 with 5.6 seconds to play to make it 66-65.

Paige made his free throws, then Carter's desperation attempt at the buzzer wasn't close.

LINEUP SHAKEUP

After losing consecutive games for the first time this season, the Tar Heels shook up their starting lineup.

Out went Jackson and Brice Johnson, who had started every game, and Kennedy Meeks, who had started 14. In came Pinson, Joel James and Isaiah Hicks.

"Justin Jackson, we decided not to start him today, but he responded the way you'd like a guy to respond," Robinson said. "It didn't quite work in the first half. It did motivate some of the other guys to play harder."

OFF THE BENCH

Boston College was also missing a coach Tuesday night: Assistant coach Bill Wuczynski was not at the game because of a death in the family.

"We wanted to play this game for our coach. Try to get this win for him," Carter said. "Obviously, we came up short, but we played our hearts out."

TIP-INS

North Carolina: The Tar Heels haven't lost three straight conference games since they started the 2013-14 season by losing three in a row.

Boston College: Forward A.J. Turner went to the court holding his right ankle a few minutes into the second half. He was helped to the locker room. He returned to the bench late in the second half still in uniform, but on crutches.

UP NEXT:

North Carolina: Hosts Pittsburgh on Sunday.

Boston College: Hosts Syracuse on Sunday.