Mass spectrometry (MS) is an analytical technique used to measure the mass-to-charge ratio of ions. It helps in identifying the composition of a sample or molecule, determining the structure of compounds, and quantifying the amount of each component in the sample.