In GC-MS, the sample is first vaporized and then carried by an inert gas (usually helium) through a column that separates the compounds based on their volatility. Once separated, the compounds enter the mass spectrometer where they are ionized. The resulting ions are then detected, and their mass-to-charge ratios are analyzed to identify the compounds.