What if the crew where trying to follow an engine out procedure to avoid terrain, which is a factor in Madrid; For my company it would be a left turn normally, but what if Spanair's is a right turn?
I would say the aircraft suffered some sort of engine failure on T/O, got airborne and started right turn too early, below V2, possibly reducing the speed further towards the stall speed, ending up in a stall, with no additional engine power available resulting to the only option left being a descend.
A further contributing factor would be the unhelpful tailwind conditions.