GC-MS operates in two main stages: gas chromatography (GC) and mass spectrometry (MS). In the GC stage, the sample is vaporized and carried by an inert gas through a column coated with a stationary phase. As the compounds travel through the column, they separate based on their chemical properties. In the MS stage, the separated compounds are ionized, fragmented, and detected based on their mass-to-charge ratio. This dual process allows for precise identification and quantification of compounds.