The complexity of polyphonic sound signals and octave errors are the two main difficulties encountered in the identification of piano sounds [Chafe and Jaffe, Proc. ICASSP, Tokyo, 1289--1292 (1986)] [E. R. S. Pearson, Ph.D. thesis, University of Warwick (1991)]. Inharmonicity, which can be important in the case of the piano, is also often an obstacle to the identification of the fundamental frequency. The aim of this paper is to present a spectral identification method which takes advantage of inharmonicity to distinguish notes and avoid octave errors. Two independent steps are required to identify piano notes with this method. First, the distribution of the partials of each note must be determined, and a database containing this information must be, once and for all, created. Then, the notes are identified by comparing the incoming spectrum with the database. Frequential fluctuations on the positions of the partials are allowed during the identification procedure. This method identifies the notes of octaves C1 and B5 and treats monophonic as well as polyphonic signals (two, three, or even four notes played with a comparable hammer velocity).