A second police officer was wounded in the gunfire.
A detective and a psychologist were questioning the student, who surrendered to police after his father arrived at the school in north Moscow and convinced him to lay down his arms, ITAR-Tass reported.
"He was detained. A measure of restraint will be determined for him," Russian Investigative Committee spokesman Vladimir Markin said. "Several tests, including a psychological and psychiatric one will be conducted on him."
The student shot and killed a geography teacher, then fired at police as they arrived, killing one officer and wounding another, an Investigative Committee official said.
Investigators said the teenager fired at least 11 shots from a rifle. He was carrying two rifles that belonged to his father, they said.
An Emergencies Ministry helicopter evacuated the wounded police officer, RIA Novosti said.
The shooter had an excellent school record and no apparent conflicts with either teachers or students, Markin said.
"The school student ... most likely he had suffered a nervous breakdown. Whatever reasons were behind his conduct will be established in the course of an investigation," he said.
Detectives "will examine a computer of the senior student and all details of his private life," Markin said.
Moscow police Chief Anatoly Yakunin said the teen's father talked the student into freeing children and surrendering.