The evaluation of sleep EEG patterns is mostly accomplished by visual analysis. With modern personal computers however, it is possible to perform signal detection within a reasonable length of time automatically. This paper presents a method for signal processing based on matched filtering. This allows the detection of sleep spindles and K-complexes in a sleep EEG recording with a high degree of accuracy. First the technique is described, and the results of a validation study based on the comparison of visual evaluations and computer analysis are presented. Thereafter, results of an application study are presented. Sleep spindle and K-complex density under the influence of lormetazepam and zopiclone were examined. Under both medications sleep spindle density increased while K-complex density decreased. Computation of Pearson’s correlation coefficients demonstrated that the interindividual sleep spindle and K-complex variations under both treatments are highly correlated. The data suggest that lormetazepam and zopiclone, although chemically different, have a similar mode of action and display comparable effects on the sleep EEG.