The unusual morphology of the Andromeda galaxy (Messier 31, the closest spiral galaxy to the Milky Way) has long been an enigma. Although regarded for decades as showing little evidence of a violent history, M31 has a well-known outer ring of star formation at a radius of ten kiloparsecs whose centre is offset from the galaxy nucleus. In addition, the outer galaxy disk is warped, as seen at both optical and radio wavelengths. The halo contains numerous loops and ripples. Here we report the presence of a second, inner dust ring with projected dimensions of 1.5×1kiloparsecs and offset by about half a kiloparsec from the centre of the galaxy (based upon an analysis of previously-obtained data). The two rings appear to be density waves propagating in the disk. Numerical simulations indicate that both rings result from a companion galaxy plunging through the centre of the disk of M31. The most likely interloper is M32. Head-on collisions between galaxies are rare, but it appears nonetheless that one took place 210 million years ago in our Local Group of galaxies.