'Oumuamua (1I/2017 U1) is the first known object of interstellar origin to have entered the Solar System on an unbound and hyperbolic trajectory with respect to the Sun1. Various physical observations collected during its visit to the Solar System showed that it has an unusually elongated shape and a tumbling rotation state1-4 and that the physical properties of its surface resemble those of cometary nuclei5,6, even though it showed no evidence of cometary activity1,5,7. The motion of all celestial bodies is governed mostly by gravity, but the trajectories of comets can also be affected by non-gravitational forces due to cometary outgassing8. Because non-gravitational accelerations are at least three to four orders of magnitude weaker than gravitational acceleration, the detection of any deviation from a purely gravity-driven trajectory requires high-quality astrometry over a long arc. As a result, non-gravitational effects have been measured on only a limited subset of the small-body population9. Here we report the detection, at 30σ significance, of non-gravitational acceleration in the motion of 'Oumuamua. We analyse imaging data from extensive observations by ground-based and orbiting facilities. This analysis rules out systematic biases and shows that all astrometric data can be described once a non-gravitational component representing a heliocentric radial acceleration proportional to r-2 or r-1 (where r is the heliocentric distance) is included in the model. After ruling out solar-radiation pressure, drag- and friction-like forces, interaction with solar wind for a highly magnetized object, and geometric effects originating from 'Oumuamua potentially being composed of several spatially separated bodies or having a pronounced offset between its photocentre and centre of mass, we find comet-like outgassing to be a physically viable explanation, provided that 'Oumuamua has thermal properties similar to comets.