The on-line measurement of the main component contents is essential for production, detection and identification of compound fertilizer. Using developed VIS-NIR sensors for on-line measurement of the main component contents in compound fertilizer, primary results about nitrogen (N), phosphorus pentoxide (P2O5) and potassium oxide (K2O) were reported. A visible (VIS) and near infrared (NIR) spectrophotometer (Ocean Optics), with a measurement range of 360.18–2221.53 nm was used to measure fertilizer spectra in reflectance mode. By using principal component analysis (PCA) and mahalanobis distance method, 3 outlier samples were detected and eliminated from 174 samples firstly. Then these models of three components with the 124 samples in calibration set were established using principal component regress (PCR) and partial least squares regression (PLS) coupled respectively with the full cross-validation technique after preprocessing the original spectrum with different methods. These models were used to estimate the contents of N, P2O5 and K2O of the other 47 samples in predicted set. The research results showed that the method could be applied to rapid measurement to the main component contents in compound fertilizer. Compared with the traditional analysis method, the on-line measurement could do it rapidly, inexpensively and pollution-freely. It suggested the potential use of the VIS–NIR sensing system for on-line measurement in the production, detection and identification process of compound fertilizer.