Each successive generation of X-ray machines has opened up new frontiers in science, such as the first radiographs and the determination of the structure of DNA. State-of-the-art X-ray sources can now produce coherent high-brightness Xrays of greater than kiloelectronvolt energy and promise a new revolution in imaging complex systems on nanometre and femtosecond scales. Despite the demand, only a few dedicated synchrotron facilities exist worldwide, in part because of the size and cost of conventional (accelerator) technology 1 . Here we demonstrate the use of a new generation of laserdriven plasma accelerators 2 , which accelerate high-charge electron beams to high energy in short distances 3-5 , to produce directional, spatially coherent, intrinsically ultrafast beams of hard X-rays. This reduces the size of the synchrotron source from the tens of metres to the centimetre scale, simultaneously accelerating and wiggling the electron beam. The resulting X-ray source is 1,000 times brighter than previously reported plasma wigglers 6,7 and thus has the potential to facilitate a myriad of uses across the whole spectrum of light-source applications.There are a number of proposals to use extreme nonlinear interactions of the latest generation of high-power ultrashort-pulse laser systems to produce beams of high-energy photons with high brightness and short pulse duration. For example, high-order harmonic generation promises trains of coherent pulselets 8 and Compton scattering could extend energies into the γ -regime 9,10 . An alternative proposal has been the use of compact laser-plasma accelerators to drive sources of undulating/wiggling radiation 11 .These accelerators use the plasma wakefield generated by the passage of an intense laser pulse through an underdense plasma 12 . Such wakefields can have intrinsic fields of more than 1,000 times greater than the best achievable by conventional accelerator technology, and thus can accelerate particles to high energies in a fraction of the distance. Recently, it has been demonstrated that at high laser power, the wakefield can be driven to sufficient amplitude to be able to trap large numbers of particles (>100 pC) from the background plasma and accelerate them in a narrow energy spread beam 3-5 , now producing beams of electrons of gigaelectronvoltscale energy of the order of 1 cm (refs 13,14).Such electron sources are of interest to replace the accelerators that drive current synchrotron sources, and typically use multiple periods of alternately poled magnets (undulators or wigglers) to reinforce the synchrotron emission over a length of a few metres. The first demonstrations of wakefield-driven radiation using external wigglers have also been reported, though still being limited to optical or near-optical wavelengths and modest peak brightness 15,16 .However, the particles being accelerated in the plasma accelerator also undergo transverse (betatron) oscillations when subject to the focusing fields of the plasma wave. These oscillations occur at the betatron frequen...