Ultraluminous x-ray sources (ULXs) in nearby galaxies shine brighter than any x-ray source in our Galaxy. ULXs are usually modeled as stellar-mass black holes (BHs) accreting at very high rates or intermediate-mass BHs. We present observations showing that NGC 5907 ULX is instead an x-ray accreting neutron star (NS) with a spin period evolving from 1.43 seconds in 2003 to 1.13 seconds in 2014. It has an isotropic peak luminosity of ~1000 times the Eddington limit for a NS at 17.1 megaparsec. Standard accretion models fail to explain its luminosity, even assuming beamed emission, but a strong multipolar magnetic field can describe its properties. These findings suggest that other extreme ULXs (x-ray luminosity ≥ 1041 erg second−1) might harbor NSs.