Keane Grace Wallis-Bennett, 12, died at Liberton High School in Edinburgh just before 10am today, as she got dressed for her PE lesson
Police Scotland said the pupil was treated by ambulance staff following the incident but they were unable to save her.
The comprehensive on the south side of the Scottish capital has around 650 pupils and 60 staff.
The incident has prompted claims on Twitter that the school is unfit for purpose and should be closed.
A spokesman for Edinburgh City Council said: "A pupil at Liberton High School has sadly died following an incident at the school. Senior education staff and health and safety officers from the school are at the school providing support to staff and pupils."
Ian Murray, the Edinburgh South MP, said on Twitter: "Tragic news coming from LIberton High School. My thoughts go out to the family and all at the school."
A Police Scotland spokesman said: "Police in Edinburgh responded to Liberton High School after a wall within the building collapsed, injuring a female pupil at 10:00.
"She was treated by ambulance staff on the scene, but was pronounced dead."
He added: "Inquiries into the full circumstances surrounding this incident are ongoing and we are working alongside our relevant partner agencies."