The variable star AR Scorpii (AR Sco) was recently discovered to pulse in brightness every 1.97 min from ultraviolet wavelengths into the radio regime. The system is composed of a cool, low-mass star in a tight, 3.55-hour orbit with a more massive white dwarf. Here we report new optical observations of AR Sco that show strong linear polarization (up to 40%) that varies strongly and periodically on both the spin period of the white dwarf and the beat period between the spin and orbital period, as well as low-level (up to a few per cent) circular polarization. These observations support the notion that, similar to neutron-star pulsars, the pulsed luminosity of AR Sco is powered by the spin-down of the rapidly rotating white dwarf that is highly magnetized (up to 500 MG). The morphology of the modulated linear polarization is similar to that seen in the Crab pulsar, albeit with a more complex waveform owing to the presence of two periodic signals of similar frequency. Magnetic interactions between the two component stars, coupled with synchrotron radiation from the white dwarf, power the observed polarized and non-polarized emission. AR Sco is therefore the first example of a white dwarf pulsar.