When a sample is exposed to primary X-rays, it excites the atoms in the sample. These atoms then emit secondary X-rays at wavelengths that are unique to each element. By detecting and analyzing these secondary X-rays, the XRF spectrometer can determine the types and amounts of elements in the sample.