Senior guard Grayson Allen, who was playing in his final home game, posted 15 points and Gary Trent Jr. added 13 for Duke (25-6, 13-5 Atlantic Coast Conference), which secured second place in the conference.
North Carolina (22-9, 11-7), which would have been the No. 2 seed for the league tournament if it won, finished in a third-place tie and dropped to a No. 6 seed for the ACC tournament in New York.
Cameron Johnson led the Tar Heels with 16 points, while Kenny Williams and Luke Maye both had 13. Theo Pinson added 12.
Johnson's 3-pointer pushed North Carolina to a 42-29 edge early in the second half.
Duke pulled within 46-43, and the volume rose considerably before Maye converted on consecutive possessions.
The Blue Devils surged again, with Trent's 3-pointer giving Duke a 52-50 edge with 9 ½ minutes to play, going ahead for the first time in more than 28 minutes of game time. Before that, Bagley scored six straight points, as his presence became huge during the rally.
Williams hit a 3-pointer on the last shot of the first half for a 35-25 UNC lead.
In a tightly contested first half, Duke missed several shots from close range and North Carolina converted on enough possessions to create uneasy feelings in the building.
Pinson's tip-in and another basket in the lane pushed North Carolina to a 30-23 lead.
The Blue Devils managed only two points in the final five minutes before the half.
Duke went 4-for-14 on first-half free throws. The Blue Devils shot 31.3 percent, including 1-for-10 on 3s, from the field before halftime.
This was Duke coach Mike Krzyzewski's 1,300th game with the Blue Devils. Of those, 1,154 have been as a nationally ranked team.
This was the 49th game all time between two top 10 teams in Cameron Indoor Stadium, with Duke improving to 38-11 in those.
North Carolina won the first meeting, 82-78, on Feb. 8 in Chapel Hill.
--Field Level Media
North Carolina | Duke | |
Cameron Johnson 16 | Scoring | Marvin Bagley III 21 |
Joel Berry II 5 | Assists | Trevon Duval 6 |
Theo Pinson 8 | Rebounds | Marvin Bagley III 15 |
Cameron Johnson 2 | Free Throws Made | Grayson Allen 3 |
Joel Berry II 2 | Steals | Grayson Allen 5 |
Luke Maye 2 | Blocks | Marvin Bagley III 2 |
Team | Points | FG% | 3PM-3PA | FTM-FTA | Assists | Rebounds | Blocks | Steals | Turnovers |
North Carolina | 64 | 37.1 | 8-31 | 4-5 | 15 | 34 | 3 | 6 | 14 |
Duke | 74 | 45.2 | 9-25 | 9-20 | 16 | 42 | 8 | 12 | 14 |