An air mass sensor includes a microelectromechanical-type sensor element having a heating element. A first temperature sensor element is arranged on the sensor element upstream of the heating element, and a second temperature sensor element is arranged on the sensor element downstream of the heating element. The first temperature sensor element has a first width and a first length, and the second temperature sensor element has a second width and a second length. To eliminate or closely limit false measurement results due to the presence of dirt on the sensor element, the first width of the first temperature sensor element is greater than the second width of the second temperature sensor element.