Seventeen of those taken to hospitals after the discovery in the early morning hours in San Antonio were in critical condition.
Seventeen of those taken to hospitals after the discovery in the early morning hours in San Antonio -- about a two hour drive from the Mexican border -- were in critical condition, suffering from heat stroke and dehydration, authorities said.
At least 39 people were in the trailer, including one person who was later found in a nearby wooded area, federal prosecutors said in a statement.
At least two were school-age children, Fire Chief Charles Hood said.
It was not immediately clear how many suspected migrants might have fled and were unaccounted for.
City police chief William McManus told CNN that the dead were all adult men. Authorities were not releasing the victims' names or nationalities until their families were notified.
Mexican officials were working with US authorities to identify the dead, the country's foreign ministry said.
McManus told a news conference that someone from the truck had approached a Walmart employee asking for water.
The employee brought water to the truck in the parking lot, and then called the police who "found eight people dead in the back of that trailer," the police chief said, calling it a "horrific tragedy."
"We're looking at a human trafficking crime," McManus said.
The truck driver had been arrested, he said.
Federal prosecutors said James Mathew Bradley Jr, 60, of Florida, was in custody and would be charged Monday morning in San Antonio.
Texas Governor Greg Abbott confirmed Sunday evening that the death toll had climbed to nine and called the case "a heartbreaking tragedy."
"Texas will continue to provide protection for the victims who have been robbed of their most basic rights, and bring down the full weight of the law for the perpetrators of this despicable crime," he said in a statement.
People in the truck were "hot to the touch," Hood said. The air conditioner in the trailer was not working.
"For those people who survived, they took a beating," he told CNN.
"With heat stroke, you sometimes have neurological deficits that you're never going to be able to recover from."
Hood estimated the temperature in the truck could have reached 150 degrees Fahrenheit (65 degrees Celsius).
"If that truck would have been there overnight, there's no doubt that we would have lost all 38 of those people," Hood said.
The US Department of Homeland Security and immigration officials are assisting local law enforcement with the investigation.
"This is not an isolated incident... this happens all the time," McManus said.
"It happens late at night, under darkness because they don't want to be discovered."
The police chief said store security footage showed that some vehicles came to pick up some travelers who were on the truck and who had made it out alive.
It was not immediately clear how long the truck had been in the parking lot, and police were working to determine who owns it.
Tens of thousands of illegal migrants from Mexico and Central America attempt to make the treacherous trip into the United States each year.
In 2003, 19 would-be migrants died in an overheated truck while being taken from south Texas near the Mexican border to Houston.
President Donald Trump has pledged to build a security wall along America's border with Mexico in order to crack down on illegal immigration.
So far, the project has been stalled by reluctance in Congress to dedicate funding for the barrier, which could cost as much as $20 billion according to some estimates.
US Homeland Security Secretary John Kelly has been to Mexico twice to discuss immigration, human trafficking and the spiraling cross-border drugs trade.
Acting Immigration and Customs Enforcement director Thomas Homan said the incident "ranks as a stark reminder of why human smuggling networks must be pursued, caught and punished."