A magnetic sector is a component of a mass spectrometer used to separate ions based on their mass-to-charge ratio by deflecting them through a magnetic field. The path of the ions is curved, with lighter ions being deflected more than heavier ones, allowing for precise mass analysis and identification of compounds.