As far as i know, there are only two ways to get altitude, by GPS or by barometer. GPS is not usable in indoor room, And iPhone5 doesn't have a barometer. But iPhone 5 can give a relative accurate altitude without barometer. How could it be possible?
The iPhone does have two ways to get altitude, but the barometer is not one of them. You can only use a barometer for relative altitudes, not absolute, unless you know the current atmospheric pressure at sea level. But as well as GPS, Apple maintains a database of the locations (presumably including altitude) of a vast number of wifi networks, so if the wifi is enabled it can determine the altitude from the database. Try turning off wifi on your phone, and see if it can still get your altitude.