The train was passing through the town of Rahim Yar Khan, in the south of Punjab province, when a stove blew up, causing a fire which spread through the train, according to local police officer Amir Taimoor.
Nadeem Zia, the medical supervisor of District Headquarters Hospital in Liaquatpur, a city in Rahim Yar Khan district, confirmed the death toll.
Footage broadcast on CNN affiliate Geo TV showed a blaze ripping through the carriages, with flames licking out of the windows and sending black smoke billowing into the sky.
Crowds gathered around the dramatic scene, as firefighters, paramedics, and soldiers responded.
An army helicopter was flown to the site from the city Multan to evacuate those who were critically injured, according to the ISPR, a media wing of the Pakistan Armed Forces.
Pakistan’s Prime Minister Imran Khan and President Arif Alvi have both shared their condolences for the victims’ families on social media.
Khan said that he had ordered the launch of an immediate inquiry to be “completed on an urgent basis.”
President Alvi “expressed profound grief on the loss of precious lives in the tragic blast caused by gas cylinder,” in a statement released on his official Twitter account.
“This is a terrible accident and we mourn those who have died,” said Sheikh Rasheed, the country’s railways minister, adding that the families of the dead and injured would receive compensation from the ministry.
Although gas cylinders are banned on trains, passengers were using gas-powered cookers to prepare breakfast inside the train carriage when the explosion occurred, Taimoor added.
He added that many of the people on board the train were heading to a protest in the Pakistani capital of Islamabad, about 800 kilometers (500 miles) from Rahim Yar Khan.
The train was running on the Tezgam line, a daily service that goes from the coastal city of Karachi to the northern city of Rawalpindi.
CNN’s Sophia Saifi contributed to this report from Islamabad.