You shouldn't have any trouble leaving the terminal and then going back in. I assume your luggage will be checked all the way through.
My sister did this just a few months ago, Terminal 4, and also had a 4-hour layover. I went to meet her there for lunch, she came out and we ate in the terminal. She only had to go back through security with her ticket and passport - as only ticketed passengers can go back through security to the gates, just like in the USA. You won't have any problem.
Saludos, MadridMan
_________________________
Visit BarcelonaMan.com for Barcelona information, Transportation, Lodging, & much MUCH more!
Curious about what could POSSIBLY be inside the brain of MadridMan? Visit
MadridMan's Madrid Blog