The intentional presence or cross-contamination of peanuts in other nut products can result in severe health problems for consumers allergic to peanuts. It is therefore essential to identify the presence of these allergenic compounds in commercialized nut products prior to their sale. For this purpose, we assessed the performance of a visible near infrared (Vis-NIR) and a shortwave infrared (SWIR) hyperspectral imaging (HSI) systems working in the spectral regions 419-1007 nm and 842-2532 nm, respectively, to identify peanut pieces in different chopped nuts (almonds, hazelnuts and walnuts). Two strategies were evaluated to create the training and validation sets. In Strategy I, these sets were composed of spectra belonging to individual pixels, whereas in Strategy II, the mean spectrum of each individual piece of nut was used. We used partial least squares discriminant analysis (PLS-DA) to develop the classification models, and the results were assessed by means of the values obtained for the sensitivity, specificity, and non-error rate (NER) statistics. The external validation procedure showed excellent classification results, with a NER of 98.3 % and 99.8 % for the Vis-NIR and SWIR systems, respectively, for Strategy I, and 100 % for both systems when Strategy II was followed. These results therefore confirm the viability of using HSI technology together with multivariate classification methods to detect peanut pieces in other chopped-nut products.