Crews from across Strathclyde fought to contain the blaze in a Co-op shop in Troon.
Appliances were sent from Ayrshire, Lanarkshire, Glasgow and Dunbartonshire to prevent the fire spreading.
Crews arrived just before 10am yesterday to tackle the blaze after reports of smoke coming from the roof of the building.
Firefighters used high-pressure hoses to tackle the flames, but the intense radiated heat and severe conditions within the roof space ignited the well-stocked store below.
The roof of the building then collapsed and for the safety of crews the incident commander created an exclusion zone around an unsupported gable wall.
Firefighters successfully extinguished the main seat of the fire and continued to attack deep-seated pockets still burning within the building.
A spokesperson for Strathclyde Fire & Rescue said: "This was a substantial fire that posed a very real threat to homes and shops connected to the building."
The cause of the fire is under investigation.