In the picture you can see the train that links Madrid to Cartagena, from Murcia.
In Spain, until now, national infrastructures are so willing radial. That is, all the roads and rails all go through Madrid. If you want to go north to south you have to go through the Spanish capital. However, there are certain roads that connect the Mediterranean coast for example from Murcia to Montpelier (France), via Barcelona.