Superconductivity often emerges in the proximity of, or in competition with, symmetry breaking ground states such as antiferromagnetism or charge density waves (CDW) 1--5 . A number of materials in the cuprate family, which includes the high--transition--temperature (high--T c ) superconductors, show spin and charge density wave order 5--7 . Thus a fundamental question is to what extent these ordered states exist for compositions close to optimal for superconductivity. Here we use high--energy x--ray diffraction to show that a CDW develops at zero field in the normal state of superconducting YBa 2 Cu 3 O 6.67 (T c = 67 K). Below T c , the application of a magnetic field suppresses superconductivity and enhances the CDW. Hence, the CDW and superconductivity are competing orders in this typical high--T c superconductor, and high--T c superconductivity can form from a pre--existing CDW state. Our results explain observations of small Fermi surface pockets 8 , negative Hall and Seebeck effect 9,10 and the "T c plateau" 11 in this material when underdoped.Charge density waves in solids are periodic modulations of conduction electron density. They are often present in low dimensional systems such as NbSe 2 4 . Certain cuprate materials such as La 2--x--y Nd y Sr x CuO 4 (Nd--LSCO) and La 2--x Ba x CuO 4 , (LBCO) also show charge modulations that suppress superconductivity near x=1/8 6,7 . In some cases, these are believed to be unidirectional in the CuO 2 plane, and have been dubbed 'stripes' 2,3 . There is now a mounting body of indirect evidence that charge and/or spin density waves may be present at high magnetic fields in samples with high T c : quantum oscillation experiments on underdoped YBa 2 Cu 3 O y (YBCO) have revealed the existence of at least one small Fermi surface pocket 8,9 which may be created by a charge modulation 10 . More recently, NMR studies have shown a magnetic--field--induced splitting of the Cu2F lines of YBCO 12 . An important issue is the extent to which the tendency towards charge order exists in high--T c superconductors 2,3 .Here we report a hard (100 keV) X--ray diffraction study, in magnetic fields up to 17 T, of a de-twinned single crystal of YBa 2 Cu 3 O 6.67 (with ortho--VIII oxygen ordering 11,13 , T c = 67 K and p = 0.12 where p is the hole concentration per planar Cu). We find that a CDW forms in the normal state below T CDW ≈ 135 K. The charge modulation has two fundamental wavevectors q CDW = q 1 = (δ 1 , 0, 0.5) and q 2 = (0, δ 2 , 0.5), where δ 1 ≈ 0.3045(2) and δ 2 ≈0.3146(7). These give satellites of the parent crystal Bragg peaks at positions such as Q=(2±δ 1 , 0, 0.5). Although the satellite intensities have a strong temperature and magnetic field dependence, the CDW is not field-induced and is unaffected by field in the normal state. Below T c it competes with superconductivity, and a decrease of the CDW amplitude in zero field becomes an increase when superconductivity is suppressed by field. Figure 1a,g shows scans through the (2--δ 1 , 0, 0.5) and (0, 2--δ 2 , 0.5) p...