Uvalde Mayor Don McLaughlin told ABC News that a total of 17 people were trapped in the container.
The victims included 15 men and two women, according to the U.S. Department of Homeland Security's Homeland Security Investigations. The two men who died were from Honduras, HSI said.
The initial 911 call came in at 3:50 p.m. local time from an "unknown third-party caller" advising there were numerous immigrants "suffocating" inside of a Union Pacific train, Uvalde police said in a statement posted on Facebook. U.S. Border Patrol was able to stop the train two to three miles outside of Knippa, Texas.
The conditions of the seven migrants who were hospitalized are unknown, Uvalde police said.
MORE: 2 men indicted for 53 migrants found dead in tractor-trailer
The Texas Department of Public Safety was investigating the incident, police said.
The HSI investigation into human smuggling remains ongoing.
MORE: Where historic number of migrants is coming from and why: ANALYSIS
Homeland Security Secretary Alejandro Mayorkas tweeted a statement Friday evening thanking Border Patrol agents who responded to the scene and Homeland Security Investigations agents supporting the investigation.
"We are heartbroken to learn of yet another tragic incident of migrants taking the dangerous journey," Mayorkas said.
He added, "We will work with the Uvalde County Sheriff's Office to hold those responsible. Smugglers are callous and only care about making a profit."
McLaughlin said "we need to look at the southern border this happens every day, if it's not my town it's somebody else's or our county ... it's every day down here."
Union Pacific said it was "deeply saddened by the tragic loss of life" and is cooperating with law enforcement and immigration officials to "review this incident and determine how it occurred."
"Safety is our focus, and we have strict policies in place to prevent unauthorized access of our trains," Union Pacific said in a statement. "We do not condone or facilitate illegal activity, and we will continue to work with officials for the safe and humane treatment of everyone who comes into contact with our company."
The portion of the highway, which runs parallel to train tracks in the area, was closed between Uvalde and Sabinal but reopened late Friday, police said.