In this paper, the basic principles of differential optical absorption spectroscopy (DOAS) technology are studied in depth, and the architecture of a motor vehicle exhaust gas detection system is built. The simultaneous detection of nitrogen oxides (NOx) and hydrocarbons (HC), the main components of motor vehicle exhaust based on Ultraviolet spectroscopy was achieved. NOx (NO) and HC (1,3-butadiene) in the exhaust of motor vehicles as the object of study. The DOAS detection system is used to obtain the spectral data, calculate the differential absorption spectrum of the gas, invert the concentration of the gas to be measured using the least squares method, and reduce the error of the measured gas concentration value using the nonlinear compensation method. The results show that the accuracy and stability of the testing system is good, and the relative error of the measurement results is within ±10% of the latest national metrology specifications.