At least 39 people have died in a train collision in southern Spain and dozens more have been injured in the country's worst rail crash in more than a decade, Spain's Civil Guard has said.

Carriages on a Madrid-bound train derailed and crossed over to the opposite tracks, colliding with an oncoming train in Adamuz on Sunday evening.

Four hundred passengers and staff were onboard both trains, the rail networks said. Emergency services treated 122 people, with 43, including four children, still in hospital. Of those, 12 adults and one child are in intensive care.

Spanish Transport Minister Óscar Puente said the death toll is not yet final, as officials launched an investigation.

Puente described the incident as extremely strange. All the railway experts consulted by the government are extremely baffled by the accident, he told reporters in Madrid.

Rail network operator Adif said the collision happened at 19:45 local time (18:45 GMT), about an hour after the train left Málaga heading north to Madrid, when it derailed on a straight stretch of track near the city of Córdoba.

The force of the crash pushed the carriages of the second train into an embankment, Puente said. Most of those killed and injured were in the front carriages of the second train, which was travelling south from Madrid to Huelva.

The type of train involved in the crash was a Freccia 1000, which can reach top speeds of 400 km/h (250 mph), a spokesperson for the Italian rail company Ferrovie dello Stato told Reuters news agency.

Rescue teams said the twisted wreckage of the trains made it difficult to recover people trapped inside the carriages. Córdoba fire chief Francisco Carmona told Spanish public broadcaster RTVE: We have even had to remove a dead person to be able to reach someone alive. It is hard, tricky work.

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 train carriages tipped over on their sides, with rescue workers scaling the train to pull people out.

The emergency agency in Andalusia urged any crash survivors to contact their families or post on social media that they are alive.

All rail services between Madrid and Andalusia were suspended following the accident and are expected to remain closed all day on Monday. An investigation is expected to take at least a month to determine the cause of the crash.

Spain's Prime Minister, Pedro Sánchez, expressed condolences, stating that the country would endure a night of deep pain. King Felipe VI and Queen Letizia also expressed concern and offered their deepest sympathies to the victims' families.

The Spanish Red Cross has deployed emergency support services to the scene, while also providing counseling for families nearby.

France's President Emmanuel Macron and other European leaders have offered their condolences, emphasizing solidarity with Spain during this tragic event.