The evolution of massive stars is influenced by the mass lost to stellar winds over their lifetimes. These winds limit the masses of the stellar remnants (such as black holes) that the stars ultimately produce. We used radio astrometry to refine the distance to the black hole x-ray binary Cygnus X-1, which we found to be 2.22−0.17+0.18 kiloparsecs. When combined with archival optical data, this implies a black hole mass of 21.2 ± 2.2 solar masses, which is higher than previous measurements. The formation of such a high-mass black hole in a high-metallicity system (within the Milky Way) constrains wind mass loss from massive stars.