A spectrum-stabilization technique suitable for the portable X-ray fluorescence analyzer is presented.The technique is realized by monitoring the scattering spectrum and has been used in CD-4 portable microcomputerized X-ray fluorescence analyzers.The stability is good and the function of the analyzer is improved obviously.