Corrosion of buried pipes is complex and difficult to model without considering corrosiveness of the soil. To estimate the external corrosion of buried and aged oil and gas pipelines, a Bayesian spectral analysis regression is proposed. The depth of the corrosion pit progression on a bare metallic pipe is linked to the soil factors that are assumed to influence its rate. The time the pipe is exposed to these factors and the annual precipitations are added to the selected soil influencing factors. The relationship between the identified factors (covariates) and the depth of the corrosion pit (response variable) is expressed as a semiparametric. Thus, the complex electrochemical process of corrosion is represented mathematically. The proposed approach is applied to the data published online by the National Institute of Standard and Technology in the US. The results allow a better quantification of the uncertainty in the predictions for each factor and an improvement in the performance of statistical prediction models of external depth of the corrosion pit.