The astronomical event GW170817, detected in gravitational and electromagnetic waves, is used to determine the expansion rate of the Universe, which is consistent with and independent of existing measurements. The gravitational-wave signature of merging black holes or neutron stars yields the distance to the merger. If a counterpart is observed and its recession velocity arising from the Hubble flow is known, then a calibration of the Hubble constant that is entirely independent of the usual 'distance ladder' is possible. The gravitational-wave event of 17 August 2017 (GW170817) corresponded to the merger of two neutron stars, and an associated 'kilonova' was seen. Daniel Holz and the LIGO–Virgo collaboration, along with a group of astronomers involved with the search for the counterpart, have determined that the Hubble constant calculated this way is about 70 kilometres per second per megaparsec. This is consistent with other determinations, but independent of them. 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,5,6. This sky region was subsequently observed by optical astronomy facilities7, resulting in the identification8,9,10,11,12,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,15,16,17,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 gravitational-wave sources will enable the Hubble constant to be constrained to high precision.