We discovered 2.8 s pulsations in the X-ray emission of the ultraluminous X-ray source (ULX) M51 ULX-7 within the UNSEeN project, which was designed to hunt for new pulsating ULXs (PULXs) with XMM-Newton. The pulse shape is sinusoidal and large variations of its amplitude were observed even within single exposures (pulsed fraction from less than 5% to 20%). M51 ULX-7 is a variable source, generally observed at an X-ray luminosity between 10 39 and 10 40 erg s −1 , located in the outskirts of the spiral galaxy M51a at a distance of 8.6 Mpc. According to our analysis, the X-ray pulsar orbits in a 2-d binary with a projected semi-major axis a X sin i 28 lt-s. For a neutron star (NS) of 1.4 M , this implies a lower limit on the companion mass of 8 M , placing the system hosting M51 ULX-7 in the high-mass X-ray binary class. The barycentric pulse period decreased by 0.4 ms in the 31 d spanned by our May-June 2018 observations, corresponding to a spinup rate Ṗ −1.5 × 10 −10 s s −1 . In an archival 2005 XMM-Newton exposure, we measured a spin period of ∼3.3 s, indicating a secular spin-up of Ṗsec −10 −9 s s −1 , a value in the range of other known PULXs. Our findings suggest that the system consists of an OB giant and a moderately magnetic (dipole field component in the range 10 12 G B dip 10 13 G) accreting NS with weakly beamed emission (1/12 b 1/4).