First-year social studies teacher Megan Silberberger intervened in the attack at Marysville-Pilchuck High School, near Seattle on Friday, teachers’ union president Randy Davis said.
Ms Silberberger intercepted Jaylen Fryberg, 15, as he paused, possibly to reload.
The attacker killed a girl and seriously wounded four others – including two of his cousins – before he died of what police said was a self-inflicted wound.
It was not clear whether he took his own life or accidentally shot himself in the struggle with Ms Silberberger.
“I’m completely amazed by her actions and I feel for her,” Mr Davis said of his colleague. “I don’t know why she was in the cafeteria but I’m just grateful she was there.”
A school resource officer also ran to the scene, Mr Davis said.
He said he had spoken briefly to Ms Silberberger, who was in shock. The Marysville School District released a statement from her, saying: “While I am thankful and grateful for the support from everyone, at this time I am requesting privacy for myself and my family.”
Fryberg, a popular student at the school, was a member of a prominent family from the nearby Tulalip Native American tribes and played for the high school football team.
It emerged that the teenager had left troubling messages on social media for months and friends said he had recently been in a fight over a girl. One of his tweets said: “It breaks me. It actually does.”
The tight-knit Native American community struggled to cope with the tragedy.
Students said Fryberg stared down his victims as he fired. Some pupils ran outside in a frantic dash to safety, while others huddled inside classrooms.
Lucas Thorington, 14, had known the victims and Fryberg since middle school. “He had a good life. He was very well known,” he said. “I don’t know what happened.”
Authorities said a .40-calibre handgun was recovered at the scene.
Three of the victims had head wounds and are in a critical condition. Two 14-year-old girls, Shaylee Chucklenaskit and Gia Soriano, are in Providence Everett Medical Centre, and Andrew Fryberg, 15, is at Harbourview Medical Centre in Seattle.
Providence said the next three days would be key in the girls’ treatment and Gia’s family released a statement, saying they appreciated “your thoughts and prayers. Our hearts go out to the other victims and their families”.
Another victim, Nate Hatch, 14, is in a serious condition at Harbourview. Family members said Andrew Fryberg, Nate and Jaylen Fryberg were cousins. Two other pupils were treated for minor wounds.
Witnesses described Fryberg as methodical in the cafeteria.
“I heard six shots go off, and I turned and saw people diving under the tables,” said 18-year-old Isabella MacKeige. “I thought, ‘Run!’”
Marysville-Pilchuck has a number of pupils from the Tulalip Native American tribes.
State senator John McCoy, a tribal member, said the community met and a prayer service took place last night. He added that the gunman’s grandmother was his secretary for 15 years.
“The family, both sides, are very religious,” he said. “If I were to walk into their homes right now, they would probably be praying.”
Mr McCoy said everyone was searching for answers. “What triggered him? That’s what we need to find out,” he said. “Because from all we have determined, he was a happy-go-lucky, normal kid.”