The increasing complexity of oil and gas reservoirs demands an accurate understanding of formation composition and mineralogy. Geochemical well logging based on prompt gamma neutron activation analysis technique (PGNAA) plays a crucial role in determining elemental concentrations, identifying lithology and improving the evaluation of matrix properties. The accuracy of elemental concentrations dictates the accuracy of other derived parameters. Elemental standard gamma ray spectra, which are predetermined for each instrument in the research and development phase, can be obtained by experimental measurements. These standards are the foundation of the processing of the neutron induced gamma ray spectroscopy and are considered to be fixed for each instrument. By using Monte Carlo numerical modelling, the standard gamma ray spectra of individual elements under different conditions are calculated. The results show that variation of borehole size, drilling mud types and other logging conditions have impacts on the shapes of the standard libraries. Therefore, if only one set of fixed standard spectra is utilized in processing measured spectra, the accuracy of elemental concentrations is affected. To address this problem, a model for compensating for the effect of logging conditions on the shapes of standard spectra is proposed. A field example is illustrated to validate the proposed method and result shows that the agreement between computed elemental weight fractions and XRF core analysis results is improved by using the introduced method.