None of the approximately 750,000 known asteroids and comets in the Solar System is thought to have originated outside it, despite models of the formation of planetary systems suggesting that orbital migration of giant planets ejects a large fraction of the original planetesimals into interstellar space. The high predicted number density of icy interstellar objects (2.4 × 10-4 per cubic astronomical unit) suggests that some should have been detected, yet hitherto none has been seen. Many decades of asteroid and comet characterization have yielded formation models that explain the mass distribution, chemical abundances and planetary configuration of the Solar System today, but there has been no way of telling whether the Solar System is typical of planetary systems. Here we report observations and analysis of the object 1I/2017 U1 (‘Oumuamua) that demonstrate its extrasolar trajectory, and that thus enable comparisons to be made between material from another planetary system and from our own. Our observations during the brief visit by the object to the inner Solar System reveal it to be asteroidal, with no hint of cometary activity despite an approach within 0.25 astronomical units of the Sun. Spectroscopic measurements show that the surface of the object is spectrally red, consistent with comets or organic-rich asteroids that reside within the Solar System. Light-curve observations indicate that the object has an extremely oblong shape, with a length about ten times its width, and a mean radius of about 102 metres assuming an albedo of 0.04. No known objects in the Solar System have such extreme dimensions. The presence of ‘Oumuamua in the Solar System suggests that previous estimates of the number density of interstellar objects, based on the assumption that all such objects were cometary, were pessimistically low. Planned upgrades to contemporary asteroid survey instruments and improved data processing techniques are likely to result in the detection of more interstellar objects in the coming years.