How a Mass Spectrometer Works

The sample is placed in a vacuum chamber, where individual atoms are released
from the sample (usually by heat or bombardment with other atoms).
The sample atoms are then converted into ions by giving them an electrical
charge (adding one or removing a number of electrons).
As charged particles, these ions can be manipulated by the electric and
magnetic fields in other parts of the spectrometer.
Using a high voltage (up to several thousand volts DC), the sample ions
are accelerated from the ion source towards a slit,
through which a fine beam of ions emerges.
The ion beam then passes through an analysing filter,
usually a magnetic field, which bends the path of the beam.
As the heavier ions have more momentum than the lighter ions, their path
is bent less. Thus the filter separates the ions in space
according to their mass; by analogy with the way in which a prism
separates a beam of light into a spectrum, this arrangement
is known as a "Mass Spectrum".
To count the number of ions emerging with a particular mass,
a second slit is placed at the appropriate location so that ions with a
different mass are blocked. The ions which pass through the slit enter
the detector, which measures the electrical current carried by the ions.
From this information the relative number of atoms which are present
in the original sample can be calculated.