Mass spectrometer. Closeup of part of a mass spectrometer. Mass spectrometers are used to analyse the chemical composition of samples of materials. They work by converting the molecules in the sample into ions. The ions are propelled to form a beam which is deflected by passing it through an electric or magnetic field. Each element has a different charge to mass ratio and so will be deflected by a different amount. This spectrum of ions can be analysed, allowing very low concentrations of chemicals to be detected.