The shooting took place at School Number 88 in Izhevsk, a city 600 miles east of Moscow in the Udmurtia region.
Russia’s Investigative Committee identified the gunman as 34-year-old Artyom Kazantsev, a graduate of the same school.
Authorities said the gunman was wearing a black T-shirt bearing “Nazi symbols”.
No details about his motives have been released.
Two security guards and two teachers were believed to have been among those killed.
The Investigative Committee said in a statement: "Currently investigators … are conducting a search of his residence and studying the personality of the attacker, his views and surrounding milieu.
"Checks are being made into his adherence to neo-fascist views and Nazi ideology.”
Videos were posted by Russian media which appeared to show panic inside the building where the shooting took place.
The footage showed children crouching down underneath desks.
The video also captured blood on a classroom floor and a bullet hole in a window.
The governor of Udmurtia, Alexander Brechalov, said the gunman, whom he said was registered as a patient at a psychiatric facility, killed himself after the attack.
Mr Brechalov said surgeons had carried out a number of operations in the wake of the shootings.
Kremlin spokesman Dmitry Peskov described the shooting as “a terrorist act” and said Russian president Vladimir Putin had given all the necessary orders to the relevant authorities.
“President Putin deeply mourns deaths of people and children in the school, where a terrorist act took place,” Mr Peskov told reporters.
The school educates children between UK years two and 12 – ages six and seven to 16 and 17.
It was evacuated and the area around it cordoned off, the governor said.
Russia’s National Guard said Kazantsev used two non-lethal handguns adapted to fire real bullets.
The guns were not registered with the authorities.
A criminal probe has been launched on charges of multiple murder and illegal possession of firearms.
Izhevsk, a city of 640,000, is located west of the Ural mountains in central Russia.
The school was situated close to central government buildings.
A three-day mourning period has been announced by the head of the region.
School shootings have been traditionally rare in Russia, unlike in the US, but there have been several other cases in recent years.
In May 2021, a teenager killed seven children and two adults after attacking a school in Kazan.
In April this year a man shot dead two children and a teacher at a kindergarten in the Ulyanovsk region, while an 18-year-old student killed 21 people and wounded dozens more after setting off a bomb in a polytechnic college in Kerch in occupied Crimea in 2018.
The attack comes as people continue to flee Russia in the wake of Mr Putin’s decision last week to announce ‘partial mobilisation’ of hundreds of thousands of civilians to bolster Russia’s struggling army in Ukraine.
However, there appeared to be no link between the shooting at the school and the conflict in Ukraine.