It uses the "mems" accelerometer thingy.
It's totally amazing how the tilt sensor in a phone/tablet and some ereaders works.
You can calibrate it with a flat perfectly level / horizontal surface. Even if the surface is wrong and a level is inaccurate, you can get the surface levelled. Then the error is constant as you rotate the level (a real bubble in a tube) or the mems.
It's OK to better than about 0.5 degree. Don't use it to level a building. There is a reason for very very long levels. Lasers draw long lines, but how do you know if really horizontal?
EDIT
There are different functional kinds
https://en.wikipedia.org/wiki/Microe...anical_systems
https://en.wikipedia.org/wiki/Microe...s#Applications
A full axis gyroscope is HUGE, though I believe first used in an aircraft in the 1930s. Mems Accelerometers work differently, though for inertial navigation they are simpler in space craft. Because the Earth is rotating, any mems or gyroscope used for inertial navigation is acting like a clock. So you need a clock to cancel that out. Except the Earth's rotation is complicated. The V2 rockets had inertial navigation powered by steam from hydrogen peroxide. A really big one could have navigated to Mars. Both Cruise Missiles and Drones use them as GPS can be jammed or spoofed.