You can actually get from Madrid to Alicante by bus in less time than you are hanging around in the airport. I have a place in Moraira, an hour north of Alicante, and a couple of years back I caught a bus from Benidorm, via Alicante to Madrid Airport which took about 6 hours...
http://www.goeuro.co.uk/buses_from_alicante_to_madrid leather seats, air con, wifi, basically better than most aircraft.
There is also a high speed train...
http://www.eurail.com/trains-europe/high-speed-trains/alvia linking the two.
Back to your original question... Yes you have plenty of time to get into Madrid and back. If your bags are checked through then because it is an internal flight you can get out and back in pretty easily.