A calibration model of near-infrared spectroscopy for the determination of water and total sugar is established and optimized in order to realize the rapid detection of physical and chemical indexes of marzipan. The partial least square method is used to establish NIR calibration models for the determination of water and total sugar in marzipan. Then, the abnormal sample removal, spectral transformation, sample set partition and characteristic wavelength selection are used to optimize its performance. The results show that the number of modeling wave points of the moisture determination model is reduced to 0.8% of the total spectrum, R and R are greater than 0.99, with RMSEC and RMSEP about 0.2 and RPD greater than 15.3. The number of modeling wave points of total sugar determination model is reduced to 1.5% of the total spectrum, and R and R are greater than 0.99, with RMSEC and RMSEP less than 0.81, and RPD greater than 17.3. There is no significant difference between the prediction results of the two optimized models and the corresponding reference values (P>0.05), which can be used in the actual detection work.