Infrared spectroscopy has been gaining prominence in entomology, such as for solving taxonomic problems, sexing adult specimens, determining the age of immature specimens, detecting drugs of abuse in fly larvae, and can be an important technique in Forensic Entomology. In order to help identify the species of Calliphoridae and Sarcophagidae families, the present study aimed to evaluate the use of near infrared spectroscopy (NIRS) coupled with chemometric methods for separating fly specimens into taxonomic categories and understanding the taxonomic relationship between them. Spectra collected from nine species of flies were subjected to unsupervised principal component analysis (PCA) and hierarchical cluster analysis (HCA), in which we sought to visualize the relationship between the samples (segregation of genera and families) with subsequent identification. In PCA, the best model was achieved using five principal components (PCs), which explained 99.16% of total variance of the original data set. The first principal component (PC1) and the fourth principal component (PC4) provided the best segregation, the latter being more important in the segregation of the species Chrysomya albiceps, Lucilia eximia, and Ravinia belforti from the others. In the HCA dendrogram, there was a clear separation between the specimens by family (Calliphoridae and Sarcophagidae) and genera (Chrysomya, Lucilia, Oxysarcodexia, Peckia and Ravinia). This study shows that NIRS is efficient to identify flies’ taxonomic properties, such as family and genera, providing quick evidence for the tested species identity.