Melamine (IUPAC: 1,3,5-Triazine-2,4,6-triamine) attracts high attention in analytical vibrational spectroscopy due to its misuse as a food adulterant. Vibrational spectroscopy [infrared (IR) and Raman and near-infrared (NIR) spectroscopy] is a major quality control tool in the detection and quantification of melamine content. The physical background for the measured spectra is not interpreted in analytical spectroscopy using chemometrics. In contrast, quantum mechanical calculations are capable of providing deep and independent insights therein. So far, the NIR region of crystalline melamine has not been studied by quantum mechanical calculations, while the investigations of its IR spectra have remained limited. In the present work, we employed fully anharmonic calculation of the NIR spectrum of melamine based on finite models, and also performed IR spectral simulation by using an infinite crystal model—periodic in three dimensions. This yielded detailed and unambiguous NIR band assignments and revised the previously known IR band assignments. We found that the out-of-plane fundamental transitions, which are essential in the IR region, are markedly more sensitive to out-of-plane inter-molecular interactions of melamine than NIR transitions. Proper description of the chemical surrounding of the molecule of melamine is more important than the anharmonicity of its vibrations. In contrast, the NIR bands mostly arise from in-plane vibrations, and remain surprisingly insensitive to the chemical environment. These findings explain previous observations that were reported in IR and NIR analytical studies of melamine.