One of the most important steps in recording, processing and analyzing gamma-ray spectra is stabilizing the measured spectrum. Baseline shifts and gain changes of any origin including environmental condition, high voltage instability and amplifying not only cause drifts in gamma-ray spectrum, but also force the spectrum to be noticeably distorted. In this work, a stabilization method based on full gamma-ray spectrum shape consideration is introduced for online as well as offline stabilization of gamma-ray spectra. The method relies upon sequentially comparing spectra, each measured during a time window, and subsequently finding the optimum shift for each time window using an artificial intelligence method aiming at minimizing the difference between the general shapes of the spectra. By utilizing spectra measured during shorter acquisition times and stabilizing them, a stable spectrum can be obtained for the longer acquisition time without the need to determine the detection system parameters, peak positions, or perform energy calibration. Subsequently, a sequence of stabilized spectra converging to the total stabilized spectrum is created. The proposed method has been applied to stabilize and analyze 14 MeV neutron induced prompt gamma-ray (PG) spectra of various samples measured using a 3 × 3 inch NaI detector. Additionally, the method has been used to stabilize the recorded spectra of 152Eu and 60Co gamma-ray point sources. The proposed method has efficiently stabilized all the tested gamma-ray spectra, resulting in a significant improvement of the analysis results.