LC-MS works by first separating a mixture of compounds using liquid chromatography. The separated compounds are then ionized and introduced into a mass spectrometer, where they are detected based on their mass-to-charge ratio (m/z). The resulting data is used to identify and quantify the compounds in the mixture.