Mass spectrometry is an analytical technique used to measure the mass-to-charge ratio of ions. It allows for the identification and quantification of molecules in complex mixtures. By ionizing chemical compounds to generate charged molecules or molecule fragments, MS can analyze the composition of a sample with high precision and sensitivity.