The Tar Heels were facing the prospect of a second straight loss, having been handed their first setback of the season last weekend by Nevada-Las Vegas.
Previously unbeaten Wisconsin took a five-point lead 8 minutes deep into the second half of a defensive struggle but North Carolina then went on an 18-5 run to take control.
North Carolina converted six free throws during the final minute to protect its lead, part of an overall 19-of-24 effort from the line. The last of those foul shots gave North Carolina a six-point lead and Wisconsin's Ben Burst accounted for the final score by hitting a 3-pointer at the buzzer.
Wisconsin shot 35 percent from the field, but turned the ball over only four times and held North Carolina to six points during the final 10 minutes of the opening half. The Tar Heels had a 26-25 lead at intermission.
The Badgers (6-1) were led by Jordan Taylor with 18 points and Jared Berggren with 14.