Emergency services were called to the fire in Insch just after midnight when a local resident noticed smoke emerging from a property in High Street.
The Scottish Fire and Rescue Service said the blaze had breached the roof of the building.
Residents in nearby flats were evacuated to a community centre but there were no casualties.
Six fire engines from nearby towns, including a height appliance from Aberdeen, were sent to tackle the fire.
Crews, including four firefighters wearing breathing apparatus, used water jets to douse the flames.
The fire service said the blaze was finally extinguished at 02:23 but they remained on the scene for several hours.
They added that an investigation will be carried out in due course.
Residents were evacuated from their homes in an Aberdeenshire town after a blaze broke out in a nearby bank.