A mass spectrometer (MS) is an analytical device used to measure the mass-to-charge ratio of ions. It helps identify and quantify molecules by ionizing chemical compounds to generate charged molecules or molecule fragments, measuring their mass-to-charge ratios, and then interpreting these measurements to provide detailed information about the molecular structure, composition, and properties.