Extreme learning machine (ELM) is combined with the discretized whale optimization algorithm (WOA) for spectral quantitative analysis of complex samples. In this method, the spectral variables selected by the discretized WOA were used to build the ELM model. Before establishing the model, the activation function and the number of hidden nodes in ELM as well as the transfer function of the discretized WOA are determined. Furthermore, the predictive performance of the full-spectrum partial least squares (PLS), ELM, and WOA-ELM models was compared with four complex sample datasets: blood, light gas oil and diesel fuels, ternary mixture, and corn samples using root mean square error of prediction (RMSEP) and correlation coefficient (R). The results show that WOA-ELM model has the best prediction accuracy compared to full-spectrum PLS and ELM models. Therefore, the proposed method provides a novel approach for quantitative analysis of complex samples