Using a model of high-harmonic generation that couples a fully quantum calculation with a semiclassical electron trajectory picture, we show that a new type of phase matching is possible when an atom is driven by an optimal optical waveform. For an optimized laser pulse shape, strong constructive interference is obtained in the frequency domain between emissions from different electron trajectories, thereby selectively enhancing a particular harmonic order. This work demonstrates that coherent control in the strong-field regime is possible by adjusting the peaks of a laser field on an attosecond time scale.