The accident happened on a key line linking Madrid to the southern city of Seville, which was also the scene of a collision in January that killed 46 people.