Spanish/English Contrasts: A Course in Spanish Linguistics is the best book out there for understanding the structure of Spanish. I recommend it for upper intermediate or advanced learners who want a linguistically informed treatment.
This book uses the technique of contrastive analysis, comparing Spanish and English to gain insights into the problems commonly faced by English-speaking learners of Spanish. The primary focus is grammar, but pronunciation is also covered in the early chapters. Although no prior knowledge of linguistics is assumed, be prepared to do some work to get the most out of this book.
By M. Stanley Whitley. Second edition. 2002. Written in English. Georgetown University Press. ISBN: 0-87840-381-7.
I particularly recommend the chapter on Tense and Mood, which describes the various historical attempts that have been made at explaining the indicative/subjunctive and preterite/imperfect distinctions to students. Here’s a choice quote about the shortcomings of traditional rules:
One understands the zeal of writers to streamline difficult grammar: reducing a point to “use X here, Y there” avoids complicated explanations, makes the point at least look manageable, and allows the class to move on to the featured ‘lectura’ on Machu Picchu.
Sample page from Spanish-English Contrasts: A Course in Spanish Linguistics
Sadly, I found the author’s other book, Gramática para la composición, overly traditional.