The attack took place at Aztec High School, New Mexico State Police said on Twitter. The school is located in the small town of Aztec some 180 miles (300 kilometers) northwest of Albuquerque in an area close to Navajo tribal lands.
Initial reports of other people being wounded are wrong, San Juan County Sheriff Ken Christesen told a press conference.
The identities of the shooter and those killed were not released.
Garrett Parker, a student at the school in the town of 7,000, told the local TV station KOAT that he was stunned.
"Out of any state, out of all the states in America, you don't think it would happen here," he said.
Parker said he was in history class when the shooting started.
"At first it sounded like kids were just banging on the lockers. But it started getting closer and louder and it was obvious it was gunshots. We could hear gunshots from right outside our door," he said.
The teacher had locked the door as he normally does and the students hid in a corner of the room.
Aztec High School was locked down and evacuated, while nearby schools were placed on lock-down.
Police set up an area in a park for parents to pick up their children, the San Juan County Sheriff's office said on its Facebook page.
"It's tragic when our children are harmed in violent ways especially on school campuses. We express our condolences to those families who have been harmed," Navajo President Russell Begaye said in a statement.
Gunfire caused the deaths or injuries of 3,700 children and teenagers this year in the United States, according to the non-profit Gun Violence Archive organization.
There were approximately 328 mass shootings, defined as involving more than two people.
More than 33,000 people in the US die each year from guns, including more than 22,000 suicides, according to the Centers for Disease Control and Prevention.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.