A massive blaze gutted an abandoned hat factory in central Sydney and forced emergency services to evacuate people from nearby apartment buildings before firefighters brought the inferno under control, without any casualties reported.

Over 30 fire trucks and 120 firefighters fought the fire in the seven-story building close to Sydney's central railway station, according to New South Wales Fire and Rescue Acting Commissioner Jeremy Fewtrell.

Hundreds of people emerging from the busy station watched from safety as the fire-baked walls collapsed onto streets that had been cleared earlier by emergency personnel.

The carcass of a burning van was parked in front.

"More than 100 firefighters, from 20 fire trucks and multiple stations, continue to work to extinguish the blaze," Fire and Rescue NSW said in an update after night fell in the city.

Two buildings had been affected by the fire, it said, both believed to have been vacant.

"Crews have also been dousing smaller fires which threatened to spread to surrounding buildings, including residential apartments."

One firefighter suffered a minor burn on his right arm but did not need hospital treatment, the fire service said.

"Firefighting operations are expected to continue throughout the night," it said.

We need your consent to load this comcast-player contentWe use comcast-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

"The public is urged to avoid the area as firefighting operations continue," the fire service said, as the sound of emergency vehicle sirens echoed through the city streets.

One commuter, Corrin Ellis, told the national broadcaster ABC he was going to catch a tram when he noticed the fire.

"All you could feel when standing here was heat on your face from the flames," Ellis told the ABC.

"And when they started to move us back, a car just in front of the building caught fire," he added.

"The front of the building collapsed and flames just spewed from the top of the building."

New South Wales Premier Chris Minns urged people to "stay safe".

"The public are advised to avoid the area as firefighting operations continue," he said on social media.