Charge-density wave order is now understood to be a widespread feature of underdoped cuprate high-temperature superconductors, although its origins remain unclear. While experiments suggest that the charge-ordering wavevector is determined by Fermi-surface nesting, the relevant sections of the Fermi surface are featureless and provide no clue as to the underlying mechanism. Here, focusing on underdoped YBa2Cu3O6+x, we propose that charge-density waves form from the incipient softening of a bond-buckling phonon. The momentum dependence of its coupling to itinerant electrons favourably selects the wavevector found in experiments. But, it requires quasiparticle renormalization by strong electronic correlations to enable a unique enhancement of the charge susceptibility near the B1g-phonon selected wavevector. The B1g phonon frequency softens by a few percent, and finite-range charge-density wave correlations will form locally, if nucleated by defects or dopant disorder. These results suggest that underdoped cuprates cannot be understood in the context of strong electronic correlations alone.