Traditional methods for detecting foodstuff hazards are time-consuming, inefficient, and destructive. Spectral imaging techniques have been proven to overcome these disadvantages in detecting foodstuff hazards. Compared with traditional methods, spectral imaging could also increase the throughput and frequency of detection. This study reviewed the techniques used to detect biological, chemical, and physical hazards in foodstuffs including ultraviolet, visible and near-infrared (UV-Vis-NIR) spectroscopy, terahertz (THz) spectroscopy, hyperspectral imaging, and Raman spectroscopy. The advantages and disadvantages of these techniques were discussed and compared. The latest studies regarding machine learning algorithms for detecting foodstuff hazards were also summarized. It can be found that spectral imaging techniques are useful in the detection of foodstuff hazards. Thus, this review provides updated information regarding the spectral imaging techniques that can be used by food industries and as a foundation for further studies.