Near-infrared spectroscopy (NIRS) can be employed to investigate brain activities associated with regional changes of the oxy- and deoxyhemoglobin concentration by measuring the absorption of near-infrared light through the intact skull. NIRS is regarded as a promising neuroimaging modality thanks to its excellent temporal resolution and flexibility for routine monitoring. Recently, the general linear model (GLM), which is a standard method for functional MRI (fMRI) analysis, has been employed for quantitative analysis of NIRS data. However, the GLM often fails in NIRS when there exists an unknown global trend due to breathing, cardiac, vasomotion, or other experimental errors. We propose a wavelet minimum description length (Wavelet-MDL) detrending algorithm to overcome this problem. Specifically, the wavelet transform is applied to decompose NIRS measurements into global trends, hemodynamic signals, and uncorrelated noise components at distinct scales. The minimum description length (MDL) principle plays an important role in preventing over- or underfitting and facilitates optimal model order selection for the global trend estimate. Experimental results demonstrate that the new detrending algorithm outperforms the conventional approaches.