Nearby hospitals were flooded with survivors, and children were among the dead - numbered and tagged but still unidentified.
"We're looking at a human trafficking crime here this evening," Police Chief William McManus told reporters gathered before dawn on Sunday.
He said his homicide detective would work with federal immigration authorities to determine "the origin of this horrific tragedy."
The truck had no working air conditioning or signs of water as it sat in the Walmart parking lot off Interstate Highway 35 in south San Antonio, about 2 1/2 hours from the Mexican border, authorities said.
Surveillance footage recorded vehicles pulling up to the truck that night, taking people from the trailer and driving away, McManus said.
But at least three dozen remained locked inside, fire chief Charles Hood told reporters, their hearts beating rapidly and their temperatures spiking.
At some point, somehow, one of the passengers got out of the trailer and asked a Walmart employee for water.
The employee "came back with the water, called the police, and we found eight dead in the back of that trailer," McManus said.
Some of the survivors ran into the trees, the police chief said, evading helicopters and foot patrols in the darkness.
But many more remained, and needed help badly.
Twenty people were hospitalized in critical or very serious condition, Hood said, with many suffering from heat stroke and dehydration.
Another eight were in better shape, but still needed treatment.
"We flooded downtown San Antonio and our critical hospitals with patients tonight," Hood said.
A reporter spotted what looked like a hearse pulling into the parking lot later that morning.
While the names and origins of the dead were not known, McManus said they included "some juveniles, some adults in their 20s, 30s."
At least two in the truck were school-age children, Hood said, without specifying if they were alive or dead.
McManus said the driver was in custody. While investigator did not yet know where the truck came, from, the police chief said human smuggling operations were routine in the area - often going undiscovered in the darkness.
"We're very fortunate there weren't 38 people that were all locked inside the vehicle, dead," Hood added.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)