Until the C16th, it was only a village. Here is the story of its growth, and role in Spain’s fortunes.