High energy electrons are fired at a target. When the electrons interact with the atoms in the target two things can happen. The first process is called breaking radiation and occurs when the electron is attracted to the positive neucleus of the atom, this slows the electron down as it loses kinetic energy it releases a photon of energy equal to the loss of kinetic energy. This photon is an X-ray and this process creates a continuous spectrum of X-ray energies. The second option is that the electron fired at the target hits an electron in an inner shell of an atom, this leaves a gap in the inner shell which one of the electrons in the atom in a higher shell will drop down to fill. In order to drop into the lower shell the electron must lose some energy and emits a photon of the same energy as the energy gap. This photon is also an X-ray and this process creates charecteristic spikes on the X-ray energy spectrum.