At least 39 people have died in a high-speed train collision in southern Spain on Sunday, Spanish police said.