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 use radio astrometry to refine the distance to the black hole X-ray binary Cygnus X-1, which we find to be $2.22^{+0.18}_{-0.17}$ kiloparsecs. When combined with previous optical data, this implies a black hole mass of $21.2pm2.2$ solar masses, higher than previous measurements. The formation of such a high-mass black hole in a high-metallicity system constrains wind mass loss from massive stars.