We present a new matching algorithm designed to compare high-resolution spectra. Whereas existing methods are bound to compare fixed intervals of ion masses, the accurate mass spectrum (AMS) distance method presented here is independent of any alignment. Based on the Jeffreys-Matusitas (JM) distance, a difference between observed peaks across pairs of spectra can be calculated, and used to find a unique correspondence between the peaks. The method takes into account that there may be differences in resolution of the spectra. The algorithm is used for indexing in a database containing 80 accurate mass spectra from an analysis of extracts of 80 isolates representing the nine closely related species in the Penicillium series Viridicata. Using this algorithm we can obtain a retrieval performance of approximately 97-98% that is comparable with the best of the existing methods (e.g., the dot-product distance). Furthermore, the presented method is independent of any variable alignment procedures or binning.