The invention relates to a method and an apparatus for identifying substances in a sample by similarity comparisons between series of ion mobility spectra of the sample and series of ion mobility spectra of reference samples. The invention comprises dividing the collection of series of spectra of reference samples - termed reference library - into classes, with the class assignment of a series of spectra being calculated from the measured values themselves, and limiting the similarity comparisons to series of spectra with the same class assignment. First and second moments of the spectra have proven to be particularly favorable characteristics for the class assignment. In a preferred embodiment, only mobility spectra of the series of spectra with the same first moments are compared with each other in the similarity comparisons.