The application of magnetic fields to layered cuprates suppresses their high-temperature superconducting behaviour and reveals competing ground states. In widely studied underdoped YBa2Cu3O6+x (YBCO), the microscopic nature of field-induced electronic and structural changes at low temperatures remains unclear. Here we report an X-ray study of the high-field charge density wave (CDW) in YBCO. For hole dopings ∼0.123, we find that a field (B≤10T) induces additional CDW correlations along the CuO chain (b-direction) only, leading to a three-dimensional (3D) ordered state along this direction at B∼15T. The CDW signal along the a-direction is also enhanced by field, but does not develop an additional pattern of correlations. Magnetic field modifies the coupling between the CuO2 bilayers in the YBCO structure, and causes the sudden appearance of the 3D CDW order. The mirror symmetry of individual bilayers is broken by the CDW at low and high fields, allowing Fermi surface reconstruction, as recently suggested.