Heavy machinery is being used to assist in the recovery following a two-train crash in southern Spain which killed at least 41 people.

Rescuers worked through a second night as more bodies are feared to be trapped in the wreckage.

More than 120 people were injured when carriages on a Madrid-bound train derailed and crossed over to the opposite tracks, hitting an oncoming train in Adamuz on Sunday evening.

A faulty or damaged weld on a rail is being investigated as a factor in the crash, Spanish media report.

Prime Minister Pedro Sanchez has cancelled his planned trip to the World Economic Forum in Davos, pledging to get to the bottom of Spain's worst train disaster in more than a decade.

Spain's King Felipe and Queen Letizia will visit the site later on Tuesday.

Three days of national mourning have been announced.

Transport Minister Óscar Puente said the death toll is not yet final and officials are working to identify the dead.

Puente said the investigation could take at least a month, describing the incident as extremely strange.

Spanish media report that a 30cm gap in one of the rails is the current focus of the investigation.

Technicians told the El Mundo newspaper that a bad or deteriorated weld was more than likely the cause for the derailment.

Four hundred passengers and staff were on board the two trains, with emergency services treating 122 people, including 41 still hospitalized, 12 of whom are in intensive care.

Most of those killed and injured were in the front carriages of the Huelva-bound train, officials said.

As the investigation into the crash continues, it was revealed that train drivers had previously warned about the state of the Madrid-Andalusia line.

Salvador Jimenez, a journalist with RTVE who was on one of the trains, described the impact as feeling like an earthquake. Footage from the scene shows some train carriages tipped over, with rescue workers scaling the train to assist trapped passengers.