How does the iPhone 5 measure elevation?
Measurements are done using the GPS. 

INFO: http://gpsinformation.net/main/altitude.htm


  GPS altitude measures the users' distance from the center of the SVs orbits. These measurements are referenced to geodetic altitude or ellipsoidal altitude in some GPS equipment.