Scottish Fire and Rescue Service (SFRS) crews were called to Liberton Primary School on Gilmerton Road, Edinburgh, on Wednesday afternoon.
Nine appliances were sent to the scene and met with a well-developed fire.
City of Edinburgh Council later confirmed it was "a fire in a first floor classroom and spread to the roof space".
Classes had finished for the day and remaining staff and pupils were evacuated safely with no casualties reported.
The council confirmed the school will be closed on Thursday and Friday ahead of the half-term February break next week.
Education convener Ian Perry said: "The decision to close the school has not been taken lightly, however unfortunately this has been a major fire which has caused significant damage to a large part of the school.
"There have been no reported injuries and I want to thank the Scottish Fire and Rescue Service and council teams for their swift response.
"We'll update parents next week regarding contingency arrangements.
"We will work closely with the fire service to determine the cause of the fire."
Lothian Buses confirmed on social media its vehicles were being "diverted down the old Dalkeith Road".
A SFRS spokesman earlier said: "We were alerted at 3.33pm on Wednesday February 5 to reports of a fire within a school in Edinburgh.
"Operations control mobilised a total of nine appliances to Liberton Primary School on Gilmerton Road, where firefighters were met by a well-developed fire.
"Crews currently remain on the scene working to extinguish the fire.
"There are no reported casualties."
In a separate incident earlier on Wednesday, crews tackled a "well-developed" fire at Watsonians Clubhouse on Myreside Road, close to George Watson's College.
The alarm was raised at around 9.20am and seven appliances were sent to the scene, as well as a high-reach vehicle.
Pictures on social media showed large plumes of smoke billowing from the property.
A SFRS spokeswoman said the fire had taken hold in the roof and first floor of the two-storey building, adding that the blaze is now under control but crews remain at the scene.