The detection of GW170817 (ref. 1) heralds the age of gravitational-wave multi-messenger astronomy, with the observations of gravitational-wave and electromagnetic emission from the same transient source. On 17 August 2017 the network of Advanced Laser Interferometer Gravitational-wave Observatory (LIGO)2 and Virgo3 detectors observed GW170817, a strong signal from the merger of a binary neutron-star system. Less than two seconds after the merger, a γ-ray burst event, GRB 170817A, was detected consistent with the LIGO–Virgo sky localization region4–6). The sky region was subsequently observed by optical astronomy facilities7, resulting in the identification of an optical transient signal within about 10 arcseconds of the galaxy NGC 4993 (refs 8–13). GW170817 can be used as a standard siren14–18, combining the distance inferred purely from the gravitational-wave signal with the recession velocity arising from the electromagnetic data to determine the Hubble constant. This quantity, representing the local expansion rate of the Universe, sets the overall scale of the Universe and is of fundamental importance to cosmology. Our measurements do not require any form of cosmic ‘distance ladder’19; the gravitational-wave analysis directly estimates the luminosity distance out to cosmological scales. Here we report H0 = kilometres per second per megaparsec, which is consistent with existing measurements20,21, while being completely independent of them.