More than three dozen people were killed as two high-speed trains collided in southern Spain.