The sensor has a spirit level (1) with a liquid (3) and gas bubble (4) in a housing (1.1) under a cover glass, where a light source (2.3) is arranged above the cover glass. Two light receivers (2.4) are arranged above the cover glass such that they detect the light emitted by the light source at the surface of the cover glass. Different light quantities are detectable by the light receivers when the gas bubble is not centered. The light source and the light receivers are arranged on a chip substrate (2.1).