The particle identification (PID) methods used for the calculation of secondary pion yields with the HARP forward spectrometer are presented. Information from time of flight and Cherenkov detectors is combined using likelihood techniques. The efficiencies and purities associated with the different PID selection criteria are obtained from the data. For the proton-aluminium interactions at 12.9 GeV/c incident momentum, the PID efficiencies for positive pions are 86% in the momentum range below 2 GeV/c, 92% between 2 and 3 GeV/c and 98% in the momentum range above 3 GeV/c. The purity of the selection is better than 92% for all momenta. Special emphasis has been put on understanding the main error sources. The final PID uncertainty on the pion yield is 3.3%. (c) 2007 Elsevier B.V. All rights reserved.