The Kalka Mail train was on its way to Kalka, in the foothills of the Himalayas, from Howrah, a station near Kolkata in eastern India, when 12 coaches and the engine jumped the tracks at Malwan station, near the town of Fatehpur in Uttar Pradesh state, senior railway official A.K. Jain said.
The cause of the derailment was not immediately clear but it appeared that the driver applied the emergency brakes, Jain said.
At least 31 people were killed and rescue workers pulled at least 100 injured passengers out of the wreckage, said Brij Lal, a state police official.
The accident site was a pile of twisted metal. At least one coach flew above the roof of another ahead of it and was dangling precariously, television footage showed. Another coach was thrown away from the rest of the train.