Firefighters were called to a roof fire in Titan St, just off Great King St, about 9.30pm.
Senior Station Officer Pete Douglas, of Roslyn Fire Station, said the fire was caused by occupants of the flat setting off fireworks too close to the property on the narrow street.
"When we pulled up smoke was coming up from both sides of the eaves and was starting to get quite thick and quite dark," Mr Douglas said.
The outcome could have been much worse had the passerby not noticed smoke coming from the roof.
"If it hadn't been noticed these guys could have gone to bed and the ceiling could have caught fire and it could have traveled into the wall cavities."
Mr Douglas reminded people to set off fireworks in a safe environment and have fire alarms installed in case something went wrong.