The boy, named by Sky sources as Bailey Gwynne, was attacked in a “shocking incident” at Cults Academy in Aberdeen at lunchtime.
He was taken by ambulance to Aberdeen Royal Infirmary suffering serious injuries but died a short time later in hospital.
The victim was a “very gentle and caring” pupil who had a lot of friends and the school community was “totally devastated”, said head teacher Anna Muirhead.
She said: “Pupils and staff are in a state of total shock.”
Officers are questioning another pupil, also aged 16, who they detained following the stabbing within the school building.
Police Scotland confirmed the death of the teenager and said his next of kin have been told.
Officers, who were called at about 1.30pm, have launched an “extensive” investigation and the detained boy is helping them with their inquiries.
Police in Aberdeen tweeted: “We can confirm that the Cults Academy incident is being treated as a murder investigation.”
Chief Inspector Graeme Mackie said: “This is a shocking and extraordinary incident for Aberdeen, and firstly our thoughts are with the family and friends of the boy who has sadly lost his life today.
“A full and thorough inquiry has been launched and there will be a police presence in the area for the foreseeable future.
“We are working closely with the education authorities and wider community as I am sure this incident will be felt not only in Aberdeen but much further afield.”
He told reporters that teams of specially-trained detectives have been interviewing witnesses who are pupils and teachers of Cults Academy.
Scotland’s First Minister Nicola Sturgeon said on Twitter: “All my thoughts are with the family & friends of the young man who has tragically died at Cults Academy today.”
An Aberdeen City Council spokeswoman said: “It is with shock and sadness that we can confirm that a pupil of Cults Academy has died following an incident at the school earlier today.
“Our heartfelt sympathies are extended to the friends and family. We will be providing support to pupils, teachers, parents and the community in the coming days.”
Cults Academy has more than 1,000 pupils and is in an affluent suburb of Aberdeen.
The school is described on its website as a six-year comprehensive serving the Lower Deeside area.
The academy has previously topped the Scottish Schools league table on the basis of its exam results.
(c) Sky News 2015