None of the children who were in School No 263 were hurt, said Karina Sabitova, a police spokeswoman at the scene.
The student also wounded a second police officer who had responded to an alarm from the school, she said.
A spokesman for Russia's main investigative agency said the student showed up at the school with a gun and a school security guard tried to stop him.
The guard was able to hit an alarm button before following the student to a 10th-grade biology class.