The fire was reported on the roof of Carmichael Auditorium.
A stray spark from welding done on the roof Monday as part of a re-roofing job apparently caused the fire, said Chapel Hill Fire Chief Dan Jones.
The fire was confined between the building's old and new roofs, officials said. Firefighters drilled holes into the new roof to reach the fire.
The auditorium is home to the UNC women's basketball team.
University employees began suctioning water at about 1:45 a.m. to prevent damage to the wooden playing floor.
"We had a lot of really good help from the housekeepers and the maintenance people who work in Carmichael," said UNC-CH's Herb Paul, physical plant director. "I think we got it under control pretty early."
Students in a nearby dormitory noticed flames coming from the top of the gymnasium at 12:40 a.m.and notified fire officials.
Howard Roofing Systems of Cary had been working on the roof since June as part of a $1.076 million project at Carmichael and the Bowman Gray Pool. Workers have been putting a metal roof over the old vinyl one at Carmichael, said Aaron Whaley of Howard Roofing. "We were two days away from being out of here," he said. However, "in terms of repairs, we"re not looking at a whole lot."