A fire official said 16 people including four children had also been taken to hospital.
The survivors were "hot to the touch" and suffering from heat stroke and heat exhaustion.
San Antonio, which is 250km (150 miles) from the US-Mexican border, is a major transit route for people smugglers.
Human traffickers often use lorries to transport undocumented migrants after meeting them in remote areas once they have managed to cross into the United States.
"They had families...and were likely trying to find a better life," San Antonio Mayor Ron Nirenberg said. "It's nothing short of a horrific, human tragedy."
Emergency responders initially arrived at the scene at about 18:00 local time (23:00 GMT) after responding to reports of a dead body, San Antonio Fire Chief Charles Hood told reporters.
"We're not supposed to open up a truck and see stacks of bodies in there. None of us come to work imagining that," he said.
He added that the vehicle, which had been abandoned by its driver, had no working air conditioning and there was no drinking water inside it.
According to KSAT local TV channel, the vehicle was discovered next to rail tracks in San Antonio's Southwest Side.
A large number of emergency responders, including police, fire, and ambulance services, could be seen surrounding the large truck.
Speaking at the same press conference, San Antonio's Police Chief William McManus said the investigation had been handed over to federal agents on Monday evening. He added that three people were being held in custody.
Mexico's Foreign Minister, Marcelo Ebrard, said that two Guatemalans were among those taken to hospital. The nationalities of the other victims was not immediately clear.
Texas's Republican Governor Greg Abbott blamed US President Joe Biden for the deaths, describing them as a "result of his deadly open border policies".
Beto O'Rourke, the Democratic candidate running against Mr Abbott, said the reports were devastating and called for urgent action to "dismantle human smuggling rings and replace them with expanded avenues for legal migration".
Immigration is a contentious political issue in the United States, where last year a record numbers of undocumented migrants were detained crossing into the country from Mexico - many traveling along extremely risky and unsafe routes.
San Antonio's climate is hot in the summer months with temperatures there reaching 39.4C (103F) on Monday.