Bayesian inversion using maximum a posteriori estimator is a quantitative approach that has been successfully applied to the electrical resistivity tomography inverse problem. In most approaches, model covariance parameters are generally chosen as stationary and isotropic, which assumes a statistical homogeneity of the studied field. However, the statistical properties of resistivity within the earth are, in reality, location dependent due to spatially varying processes that control the bulk resistivity of rocks, such as water content, porosity, clay content, etc. Taking into account the spatial variability of the resistivity field, we use the nonstationary Matérn covariance family, which is defined through linear stochastic partial differential equations. Two types of prior information are considered: structure orientation and spatially increasing the range with increasing depth. The latter is applied successfully on the first synthetic model, which aims at retrieving the depth of bedrock and the shape of the conductive lens. In the second synthetic example, a conductive dike model embedded into four layers is used to study the performance of structure orientation. Finally, the proposed approach is used to invert real data measured over an extensively characterized sandy-to-silty aquifer. First, the structure orientation of this aquifer was determined by applying a structure tensor calculated using gradients of the ground penetrating radar image. The introduction of this information gives a resistivity model that is more compatible with the aquifer structure.