The enormous blaze shot flames high into the air above trees in Llangennech, near Llanelli, and a towering column of black smoke erupted from the fire which began at around 11.30pm on Wednesday night.
Two people known to be on board the train have been accounted for, and no injuries have been reported, according to British Transport Police.
Three carriages of the train were alight and an evacuation zone was put in place, Dyfed-Powys Police said.
They said the fire had been declared a “major incident” because of the “initial risk of harm” to people nearby.
One person on Twitter said they could smell the burning fuel from over a mile away.
Footage taken on Thursday morning showed the fire continuing to burn as clouds of dense black smoke pour from the crash site.
British Transport Police Assistant Chief Constable Sean O’Callaghan said: “This is a significant incident. Resources from across BTP, South Wales Fire and Rescue Service and Dyfed-Powys Police have been deployed to the scene to mitigate damage to the surrounding area and ensure the safety of all those living nearby.
“The fire continues and there is still a substantial risk within its immediate vicinity, so our advice remains for people to avoid the area.”
The force has announced an investigation into the incident is now underway.
“Our officers will be conducting initial enquiries into the incident and are in the process of securing key witness statements and CCTV.
“Once the fire has been extinguished, and the scene is safe to assess and investigate, we’ll be working with the Office of Rail and Road and the Rail Accident Investigation Branch to establish the exact circumstances behind the incident.”
Road closures remain in place, Dyfed-Powys Police said. People are asked to avoid the Llangennech and Hendy areas, and vehicles on the M4 are being asked to continue to Pont Abraham.
Dyfed-Powys Police Superintendent Ross Evans said: “This is a fast-moving situation, which has been declared a major incident.
“There are a significant number of emergency services personnel at the scene, and an evacuation zone has been put in place.
“Officers are in contact with people within that area asking them to leave their homes, and we urge people to comply with officers’ requests to ensure a swift and efficient evacuation.
“We are working closely with our colleagues at British Transport Police, Mid and West Wales Fire and Rescue Service, Carmarthenshire Council, and Natural Resources Wales to bring the incident to a safe conclusion.”
Register for free to continue reading
Registration is a free and easy way to support our truly independent journalism
By registering, you will also enjoy limited access to Premium articles, exclusive newsletters, commenting, and virtual events with our leading journalists
Already have an account? sign in
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies