A magnetic field sensor for low power applications includes a magnetic field sensing element that, during sample intervals, provides a signal proportional to a sensed magnetic field and also includes a comparator circuit that, during the sample intervals, compares the magnetic field signal to threshold levels to generate a sensor output signal indicative of a strength of the magnetic field. According to a dual sample rate feature, initially the magnetic field signal is sampled at a first predetermined sample rate and, following detection of a transition of the sensor output signal, is sampled at a second, faster predetermined sample rate for a predetermined interval. According to a user-programmable sample rate feature, a user may select to operate the sensor at a fixed, predetermined sample rate or at a user-specified sample rate. The magnetic field sensor may also or alternatively detect the speed and/or direction of rotation of a rotating magnetic article.