In many applications of energy-dispersive XRF analysis, quantitative information concerning the chemical composition of the samples is not required. Rather, one is interested in whether a given sample is similar to some reference material or whether the chemical composition is changing from one sample to the next. We have investigated the use of pattern-recognition techniques in such applications. It will be demonstrated with experimental data that the pattern-recognition approach is extremely simple and fast. It uses only a single parameter, the normalized correlation coefficient, and can be applied directly to raw data. The efficacy of the method is illustrated with Si(Li) spectra of geological and pigment samples, and proportional counter spectra of geological samples. The pattern-recognition method should be ideally suited for field XRF applications, and the algorithm can be easily implemented on a personal computer.