The Gorakhpur Express passenger train was travelling at high speed and slammed on its brakes in an attempt to stop, but ploughed into the train sitting on the tracks near a railway station in Uttar Pradesh state, district magistrate Bharat Lal said.
Six of the cars on the express train derailed. At least 40 people were killed and about 100 others were injured, senior police officer Amrendra Sainger said.
Authorities were searching for the station master, who disappeared after the accident in Sant Kabir Nagar, about 140 miles south east of the state capital, Lucknow.
Rescuers worked to free people trapped under toppled cars and debris. The express train's driver and assistant driver were in a critical condition, railway official Alok Kumar said.
Trains were diverted to other tracks to avoid the wreckage. Narendra Modi, who was later sworn in as India's new prime minister, expressed condolences to the families of the dead on Twitter. "Prayers with the injured," he said.
Accidents are common on India's railroad network, one of the world's largest with 20 million people riding daily on about 11,000 passenger trains. Most accidents are blamed on poor maintenance and human error.
Earlier this month, a train crashed into a jeep at an unmanned railroad crossing in Uttar Pradesh, killing 13.
Four days earlier, a passenger train derailed, killing at least 19 people just south of Mumbai. Another train derailment last month left dozens injured in the northeast state of Assam.