The death toll has risen to 21 people, including 18 children after a mass shooting at a Texas primary school.

State Governor Greg Abbott said the suspect, an 18-year-old local man who has also died, opened fire at Robb Elementary School in Uvalde, about 137km west of San Antonio.

Texas state senator Roland Gutierrez called the event “devastating”.

“I can’t imagine what it would mean to send your child off to school in the morning and not have them return,” he said.

It was the deadliest shooting at a US grade school since the shocking attack at Sandy Hook Elementary in Newtown, Connecticut, almost a decade ago.

The gunman entered the school with a handgun and possibly a rifle, Abbott said.

Officials have not revealed a motive for the shooting, but said the shooter was a resident of the community.

Abbott said the shooter was probably killed by responding officers but events were still being investigated.

Uvalde Consolidated Independent School District Chief of Police Pete Arredondo said at a news conference the gunman acted alone.

It was the deadliest school shooting in Texas history.

It occurred four years after a gunman fatally shot 10 people at Santa Fe High School in the Houston area and less than two weeks after a gunman opened fire at a supermarket in Buffalo, New York, killing 10 Black shoppers and workers in what officials have described as a hate crime.

“He shot and killed, horrifically, incomprehensibly, 14 students and killed a teacher,” said the governor, adding that two officers were shot and wounded but were expected to survive.

It was not immediately clear how many people, in addition to the dead, were wounded, but Arredondo said there were “several injuries”.

Earlier, Uvalde Memorial Hospital said 13 children were taken there.

Another hospital reported a 66-year-old woman was in critical condition.

Robb Elementary School has an enrolment of just under 600 students, and Arredondo said it serves students in the second, third and fourth grade. He did not provide ages of the children who were shot.

A heavy police presence surrounded the school on Tuesday afternoon, with officers in heavy vests diverting traffic and FBI agents coming and going from the building.

White House press secretary Karine Jean-Pierre said President Joe Biden had been briefed on the shooting on Air Force One as he returns from a five-day trip to Asia, and would continue to receive updates.

Jean-Pierre said Biden will address the incident at the White House.

Uvalde is home to about 16,000 people and is the seat of government for Uvalde County. The town is about 120km from the border with Mexico.

Robb Elementary is in a mostly residential neighbourhood of modest homes.

A Border Patrol agent who was among the first law enforcement officers on the scene was shot and wounded by the gunman, but is expected to recover.

The tragedy in Uvalde added to a grim tally of mass shootings in Texas that have been among the deadliest in the US over the past five years.

A year before the Santa Fe school shooting in 2018, a gunman at a Texas church killed more than two dozen people during a Sunday service in the small town of Sutherland Springs.

In 2019, another gunman at a Walmart in El Paso killed 23 people in a racist attack.

The shooting comes days before the National Rifle Association annual convention is set to begin in Houston.

Abbott and both of Texas’ US senators are among elected Republican officials scheduled to speak at a Friday leadership forum sponsored by the NRA’s lobbying arm.