Truck driver James Bradley, 60, has been arrested on suspicion of smuggling people across the border from Mexico.
The bodies were found in the trailer of his truck in a Walmart parking lot in San Antonio, the city which is home to the famous Alamo landmark.
Tragedy came to our doorstep. Our city prays for the victims & families. Thank you to fire, police & EMS who provided care to the survivors.— Mayor Ron Nirenberg (@Ron_Nirenberg) 23 July 2017
People smugglers are believed to have hidden immigrants in the back of the truck, despite it having no air conditioning, and with temperatures at this time of year in Texas regularly hitting 38 degrees Celsius.
The parking lot appeared to have been the agreed location where the people smugglers had arranged for the migrants to be picked up because several cars and pick-up trucks were seen, shortly after the truck arrived.
As law enforcement officers arrived at the scene some of those in the truck ran off into the nearby woods.
"We got a call from a Walmart employee about a welfare check in a tractor-trailer that was parked on the lot here. He was approached by someone from that truck, who was asking for water. Came back with water, called the police, and we arrived on scene, and found eight people dead in the back of that trailer," San Antonio Police Chief William McManus said at a news conference.
One person died later, bringing the death toll to nine.
The Mexican government said it was working with the US authorities to identify the identities and nationalities of the dead.
San Antonio is only a couple of hours' drive from the border.
Every year thousands of people from Latin American countries try to cross the border and US President Donald Trump has already ordered a huge wall to be built along the entire frontier.
But since the NAFTA free-trade agreement was set up, several US companies built factories — often known as maquiladoras — just across the border in Mexico, and trucks import thousands of tons of goods every day.
The tragedy in San Antonio has eerie similarities with a case in England 17 years ago.
Sixty Chinese immigrants had paid so-called "snakehead" people smugglers to get them into Britain. They were flown from China to Belgrade, and were then taken to Rotterdam, where they were hidden in the back of a truck loaded with a cargo of tomatoes.
But 58 of the 60 were found dead in the back of the truck at Dover docks after they arrived on a ferry.
Truck driver Perry Wacker was jailed for 14 years after being convicted of manslaughter in 2001.
The court heard he had closed the only air vent, in order to muffle their cries, and they suffocated to death.
The two survivors gave evidence at Wacker's trial.
Ke Shi Guang, 22, told of the panic as they realized the air vent had been closed.
"They started panicking after about two to three hours because the vent was shut and there was no air. Some people removed tomatoes and tried to kick open the doors. There was also a lot of shouting and screaming, but nobody came to help," Mr. Guang told the trial.
In the wake of the Dover incident the British authorities introduced Passive Millimeter Wave Imaging devices, which scan trucks to detect the presence of "clandestines."
Each scanner costs around £800,000 (US$1 million) to buy, and £83 (US$108) to run for 24 hours.
In 2014 it was reported 18,000 "clandestines" had been detected at Britain's borders in the previous 12 months.
On the Home Office blog earlier this month the Border Force said "all freight vehicles are screened for hidden people or other contraband."
"The Border Force uses a range of techniques including detection dogs, carbon dioxide detectors and motion detection technology — as well as visual checks and physical searches to detect stowaways hidden deep within vehicles," they said.
Fact sheet: The UK’s juxtaposed border controls https://t.co/PlVkfyobgf by HO News Team— New Blog Posts (@New_Blog_Posts) July 11, 2017
"Officers are also acting on intelligence, targeting vehicles thought to be linked to organized crime groups," they add.
Haulage companies also face stiff fines for allowing stowaways to get into or onto their vehicles.
Home Office data shows 3,522 fines, totaling £7.8 million (US$10.1million) were handed to truck drivers in 2016/17 after "clandestine entrants" were discovered.
But occasionally people get through.
In 2016, 10 Eritreans were caught as they tried to hide away on a Hungarian truck. They were found on the French side of the border.
But when the truck driver, Lorinc Gyula, checked his trailer after stopping for a meal at a transport cafe in Kent, he found an 11th man had been crushed to death under a pile of Christmas catalogs in the truck. He has still not been identified.