Vis/NIR spectroscopy was used to measure the moisture content of ginger. 330 samples were separated into two groups, as training and validation. Vis/NIR reflection spectral data from 350 to 1800 nm were collected using ginger within the training and validation sets. PSO was used to establish the PLS model. In comparison to the full spectrum model (contained 1451 variables), the prediction capability was improved after using PSO for PLS models. The number of selected variables and LVs were 300 and 6, respectively. The correlation of determination in validation set (), root mean square error of prediction (RMSEP), and bias by PSO-PLS were 0.9881, 4.7827, and 0.1751.