Plenty of time to do some sightseeing and have a couple meals. I think there is information in the Europe forum or trip advisor forum would give you some suggestions for day.
http://www.tripadvisor.com/ShowForum...26-Madrid.html
The MAD airport can take some time to get around depending upon the terminal. For me, I'd plan on arriving 2.5 hours prior and take advantage of the lounge if you have extra time.