An 18-year-old gunman has opened fire at a school in Texas, killing 14 children and a teacher and injuring others, state governor Greg Abbott 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 Robb Elementary School in Uvalde with a handgun and possibly a rifle, Mr Abbott said.

Officials have not revealed a motive for the shooting, but said the gunman was a resident of the community, which is about 85 miles west of San Antonio.

Mr Abbott said the gunman was likely to have been killed by responding officers but that the events were still being investigated.

Uvalde Consolidated Independent School District chief of police Pete Arredondo said at a news conference that 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.

People leave the Uvalde Civic Centre following a shooting earlier in the day at Robb Elementary School in Uvalde, Texas
People leave the Uvalde Civic Centre following a shooting earlier in the day at Robb Elementary School in Uvalde, Texas (William Luther/The San Antonio Express-News via AP)

“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 Mr 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 a critical condition.

Robb Elementary School has an enrolment of just under 600 students and Mr 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 has been briefed on the school shooting on Air Force One as he returns from a five-day trip to Asia and would continue to receive updates.

Law enforcement personnel stand outside Robb Elementary School following a shooting in Uvalde, Texas
Law enforcement personnel stand outside Robb Elementary School (Dario Lopez-Mills/AP)

Ms Jean-Pierre said Mr Biden will deliver remarks on Tuesday evening 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 75 miles 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.

The agent is in hospital in good condition, according to a federal law enforcement official who spoke to the Associated Press.

Law enforcement personnel stand outside Robb Elementary School in Uvalde, Texas, following a shooting
Law enforcement personnel outside the school (Dario Lopez-Mills/AP)

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.

One 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 came days before the National Rifle Association (NRA) annual convention was set to begin in Houston.

Mr Abbott and both of Texas’s US senators were among elected Republican officials who were the scheduled speakers at a Friday leadership forum sponsored by the NRA’s lobbying arm.