On 17 August 2017, the Advanced LIGO1 and Virgo2 detectors observed the gravitational-wave event GW170817-a strong signal from the merger of a binary neutron-star system3. Less than two seconds after the merger, a γ-ray burst (GRB 170817A) was detected within a region of the sky consistent with the LIGO-Virgo-derived location of the gravitational-wave source4-6. This sky region was subsequently observed by optical astronomy facilities7, resulting in the identification8-13 of an optical transient signal within about ten arcseconds of the galaxy NGC 4993. This detection of GW170817 in both gravitational waves and electromagnetic waves represents the first 'multi-messenger' astronomical observation. Such observations enable GW170817 to be used as a 'standard siren'14-18 (meaning that the absolute distance to the source can be determined directly from the gravitational-wave measurements) to measure the Hubble constant. This quantity represents the local expansion rate of the Universe, sets the overall scale of the Universe and is of fundamental importance to cosmology. Here we report a measurement of the Hubble constant that combines the distance to the source inferred purely from the gravitational-wave signal with the recession velocity inferred from measurements of the redshift using the electromagnetic data. In contrast to previous measurements, ours does not require the use of a cosmic 'distance ladder'19: the gravitational-wave analysis can be used to estimate the luminosity distance out to cosmological scales directly, without the use of intermediate astronomical distance measurements. We determine the Hubble constant to be about 70 kilometres per second per megaparsec. This value is consistent with existing measurements20,21, while being completely independent of them. Additional standard siren measurements from future gravitationalwave sources will enable the Hubble constant to be constrained to high precision.