Print 

A very interesting, if quirky, read if you are planning a trip to Madrid is Maya by Jostein Gaardner (who wrote Sophie’s World). The story moves from Fiji to Madrid, via Salamanca and Seville and this book is a good holiday read if you are visiting any of these places. 

The New Spaniards is a non-fiction book, available in paperback, that gives a comprehensive overview of all phases of Spanish life from home ownership (tops in EU) to the movies. John Hooper, a British correspondent, covers political, economic, social, religious, educational and cultural events up to 1995.  It's very readable and informative.

The Castles and the Crown by Townsend Miller.  This is an excellent background book about the history of Spain during the era of Isabel and Fernando.  Miller paints a rich picture of that turbulent and pivotal time.  Emotional, captivating and very informative.  The book is out of print but may be purchased "used" online.

Hidden Madrid 1 and Hidden Madrid 2 by Mark and Peter Besas are presented as walking guides to Madrid.  Loaded with secret histories, anecdotes, legends, ghost stories and facts, these guidebooks give you a glimpse into Madrid that few people get to see otherwise.  See the best sights of Madrid with an eye to the past and get tips on everything from where the best place to have a bocadillo de calamares is to where you can see a museum to the Ratoncito Perez (the Spanish tooth Fairy).

 The Captain Alatriste series by Arturo Perez-Reverte is swashbuckling good fun!  Set in 1600s Spain, Diego Alatriste lunges from one adventure to the next, always surrounded by the art, poetry, theater and customs of the day.  Find the audiobooks if you can!

 The Spanish Game is set in 2003 Madrid and features Alec Milius, a former SIS agent.  This book by Charles Cumming is a sequel to A Spy by Nature.

Madrid: The History by Jules Stewart is a 300-pager but if you're a history buff, it's a great read. The Kindle version is much, much cheaper!

Madrid: A Cultural and Literary Companion (Cities of the Imagination) by Elizabeth Nash is great for literature lovers, and Madrid's got plenty of literary legends to cover.

Miracle in Seville by James Michener.

A Load of Bull, An Englishman's Adventures in Madrid by Tim Parfitt. Funny misadventures in the late 80s, early 90s.

Online

Travel guide on things to do in and around Madrid - http://www.holidayen.com/explore/Madrid

Mobile travel guide on Madrid attractions, things to do, tours and other activities (here and here