The student gunman also seriously wounded a second police officer who had responded to an alarm from the school, investigators said.
None of the approximately 400 children in School No. 263 at the time were hurt, said Karina Sabitova, a police spokeswoman. But students were so fearful that some ran from the building with their teachers without stopping to put on coats in below-freezing temperatures. The school in northeast Moscow is for children in grades one through 11.
Such shootings in Russian schools are extremely rare. Any attack on a school, however, unavoidably brings back memories of the Beslan school siege in 2004, when Islamic militants from Russia's North Caucasus took about 1,000 people hostage, most of them children. More than 300 hostages were killed when Russian security forces stormed that school.
Russia is also now on alert for terrorist attacks, especially after Islamic militants asserted responsibility for twin suicide bombings in the city of Volgograd in December and threatened to strike during the Sochi Winter Olympics, which begin Friday in the Black Sea resort.
Monday's attack, however, raised no suspicions of any link to terrorism.
The ethnic Russian teenager entered the school after threatening its security guard, who managed to hit an alarm before following the student to his classroom, said Vladimir Markin, spokesman for Russia's Investigative Committee, its main investigative agency.
"Without saying a word, he fired several shots at the geography teacher," Markin said.
Markin identified the teenager as Sergei Gordeyev and said he was an excellent student who apparently had an emotional breakdown. Gordeyev fired at least 11 times from a small-caliber rifle, also killing one police officer and wounding a second, Markin said.
The youth's father was immediately called to the school. He spoke to his son on the phone for 15 minutes to try to persuade him to let the 20 or so students in the classroom leave, but the boy refused, Moscow police chief Anatoly Yakunin said in televised remarks.
The father, wearing a bullet-proof vest provided by police, then went into the classroom. About 30 minutes later, the trapped students walked out, leaving the father and son alone in the classroom, and police special forces stormed in, Yakunin said.
Investigators were questioning Gordeyev, his classmates, school staff and the security guard to try to determine why he shot the teacher, Markin said.
He identified the teacher as Andrei Kirillov, aged 29 or 30, correcting an earlier statement that a 76-year-old teacher with the same last name had been killed. Kirillov's wife is a teacher at the same school and they have a young son.
In addition to the small-caliber rifle, Gordeyev was also carrying a carbine, a short-barreled rifle, the police chief said, adding that both rifles belonged to his father and were legally registered. Ownership of hunting rifles is permitted in Russia if they are properly registered.
President Vladimir Putin responded to the shooting by saying that Russia should do a better job at providing a cultural education for its children.
"We have to raise a new generation of theatergoers with good artistic taste who can understand and value theatrical, dramatic and musical art," he said at a televised gathering of cultural figures. "If we had done this in a proper way, then perhaps there would not have been a tragedy like today's in Moscow."
Putin said culture should teach children to believe in the strength of goodness.
Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.