As the most important properties in the gasoline blending process, octane number is difficult to be measured in real time. To address this problem, a novel deep learning based soft sensor strategy, by using the near-infrared (NIR) spectroscopy obtained in the gasoline blending process, is proposed. First, as a network structure with hidden layer as symmetry axis, input layer and output layer as symmetric, the denosing auto-encoder (DAE) realizes the advanced expression of input. Additionally, the stacked DAE (SDAE) is trained based on unlabeled NIR and the weights in each DAE is recorded. Then, the recorded weights are used as the initial parameters of back propagation (BP) with the reason that the SDAE trained initial weights can avoid local minimums and realizes accelerate convergence, and the soft sensor model is achieved with labeled NIR data. Finally, the achieved soft sensor model is used to estimate the real time octane number. The performance of the method is demonstrated through the NIR dataset of gasoline, which was collected from a real gasoline blending process. Compared with PCA-BP (the dimension of datasets of BP reduced by principal component analysis) soft sensor model, the prediction accuracy was improved from 86.4% of PCA-BP to 94.8%, and the training time decreased from 20.1 s to 16.9 s. Therefore, SDAE-BP is proposed as a novel method for rapid and efficient determination of octane number in the gasoline blending process.