More than 100 firefighters battled a blaze which broke out at a construction site.
Hampshire Fire and Rescue Service was called to the fire at the timber-framed block of flats on Gershwin Road, Basingstoke at 6.21pm last night.
There were fears the four-storey building could collapse and that the flames could spread to other properties due to prevailing wind conditions.
A spokeswoman for Hampshire Fire and Rescue Service said the fire had been brought under control and an investigation into the cause of the blaze was already under way.
Crews from Hampshire, Surrey and Berkshire were mobilised and 16 fire engines, three water carriers, two aerial ladder platforms and a multi-role vehicle was used.
Hampshire Fire and Rescue Service Chief Officer, John Bonney, who is also President of the Chief Fire Officers Association, warned about the danger of timber-framed buildings.
He said: "When timber-framed buildings catch fire the actual structure burns. It often leads to total collapse and that puts the safety of our firefighters at risk.
"The potential for fire spread was clearly of major concern at this incident, and shows that the Chief Fire Officers Association is right to be increasingly concerned about the number and severity of fires in timber-framed buildings under construction."