Minister for Railways Sheikh Rashid Ahmed said the fire was caused by the explosion of a gas cylinder being used by passengers cooking breakfast.
According to officials cited in local media, many of the victims died as they tried to jump off the burning train.
Another 40 people have been injured. Officials say the number of dead may still rise.
The accident happened near the town of Rahim Yar Khan in the south of Punjab province.
Many passengers were pilgrims heading to Raiwind near Lahore for one of Pakistan’s largest annual religious congregations, organised by the Tablighi Jamaat Sunni Muslim missionary movement. The train was reportedly diverted to help these religious travellers.
Mohammad Ramzan, who was on board, told BBC Urdu some pilgrims were making tea when their gas cylinder exploded. He jumped from the train to safety.
One survivor told BBC Urdu he was in carriage 11 when they realised there was a fire just after they had finished morning prayers.
“There was chaos everywhere,” he said. “It was very difficult for us to get out and save ourselves.”
Another man said he could smell something in the night, “but no one paid attention”. He and his friends helped take the injured to hospital.
“I have no words to explain what we saw,” he said. “The rescue teams got there very late.”
District deputy commissioner Jamil Ahmed said some of the victims were so badly burnt they could not be identified, and they would need to use DNA to find out who had died.
What was the cause?
Passengers bringing stoves onto trains in order to cook meals on long journeys is a common problem, the minister said. Though it is common to carry food on board, gas cylinders are banned.
But reports from the scene suggest electrical problems could have been the cause. Several survivors have reportedly said they believed a short-circuit on board may have been to blame.
Prime Minister Imran Khan said he was “deeply saddened by the terrible tragedy” on Twitter, adding that he had ordered an “immediate inquiry”.
After an earlier suspension in the wake of the fire, the railways minister said services have now been restored.