We analysed recent K2 data of the short-period eclipsing binary system HW Vir, which consists of a hot subdwarf-B type primary with an M-dwarf companion. We determined the mid-times of eclipses, calculated O-C diagrams, and an average shift of the secondary minimum. Our results show that the orbital period is stable within the errors over the course of the 70 days of observations. Interestingly, the offset from mid-orbital phase between the primary and the secondary eclipses is found to be 1.62 s. If the shift is explained solely by light-travel time, the mass of the sdB primary must be 0.26 M⊙, which is too low for the star to be core-helium burning. However, we argue that this result is unlikely to be correct and that a number of effects caused by the relative sizes of the stars conspire to reduce the effective light-travel time measurement. After removing the flux variation caused by the orbit, we calculated the amplitude spectrum to search for pulsations. The spectrum clearly shows periodic signal from close to the orbital frequency up to 4600 µHz, with the majority of peaks found below 2600 µHz. The amplitudes are below 0.1 part-per-thousand, too low to be detected with ground-based photometry. Thus, the high-precision data from the Kepler spacecraft has revealed that the primary of the HW Vir system is a pulsating sdBV star. We argue that the pulsation spectrum of the primary in HW Vir differs from that in other sdB stars due to its relatively fast rotation that is (nearly) phase-locked with the orbit.