Investigators say the suspect was armed with a handgun, an AR-15 semi-automatic rifle and high-capacity magazines when he opened fire at Robb Elementary School.
All those killed in the Texas school shooting were in one classroom, a state public safety official has said.
It is America’s deadliest school shooting since 20 children and six adults died at Sandy Hook Elementary in Newtown, Connecticut, in late 2012.
The gunman – identified by officials as Salvador Ramos, who lived in the community – was killed by law enforcement responding to the massacre. Texas governor Greg Abbott said one of the two adults killed by the gunman was a teacher.
The teenage gunman is suspected of shooting his grandmother before the rampage.
It was the deadliest shooting at a US grade school since a gunman killed 20 children and six adults at Sandy Hook Elementary in Newtown, Connecticut, almost a decade ago.
Federal law enforcement officials said the death toll was expected to rise. They spoke on condition of anonymity because they were not authorised to release investigative details.
The gunman, who was wearing body armour and had hinted on social media of an upcoming attack, crashed his car outside the school and went inside armed, Erick Estrada of the Texas Department of Public Safety told CNN.
Officials did not immediately reveal a motive, but the governor identified the assailant as Salvador Ramos and said he was a resident of the heavily Latino community about 85 miles (135 kilometres) west of San Antonio.
A Border Patrol agent who was nearby when the shooting began rushed into the school without waiting for backup and shot and killed the gunman, who was behind a barricade, according to a law enforcement official speaking on condition of anonymity because he was not authorised to talk about it.
The agent was wounded but able to walk out of the school, the law enforcement source said.
Governor Greg Abbott said the gunman was likely killed by police officers but that the events were still being investigated. The school district’s police chief, Pete Arredondo, said that the attacker acted alone.
The massacre of young children was another gruesome moment for a country scarred by an almost ceaseless string of mass killings at churches, schools and stores.
And the prospects for any reform in the nation’s gun regulations seemed at least as dim as in the aftermath of the Sandy Hook deaths.
US President Joe Biden has called for new restrictions on firearms in America after a gunman massacred at least 19 children at a Texas elementary school.
In an emotional address to his nation from the White House, Mr Biden pleaded for action to curb gun violence after years of failure – and blamed firearms manufacturers and their supporters for blocking legislation in Washington.
He said: “When in God’s name are we going to stand up to the gun lobby? Why are we willing to live with this carnage? Why do we keep letting this happen?”
“Pray for the lost, their families, and Uvalde,” San Antonio mayor Ron Nirenberg said in a tweet.
The shooting came days before the National Rifle Association (NRA) annual convention was set to begin in Houston.
Mr Abbott and both of Texas’ US senators were among elected Republican officials who were the scheduled speakers at a Friday leadership forum sponsored by the NRA’s lobbying arm.