To minimize the number of solutions in 3D resistivity inversion, an inherent problem in inversion, the amount of data considered have to be large and prior constraints need to be applied. Geological and geophysical data regarding the extent of a geological anomaly are important prior information. We propose the use of shape constraints in 3D electrical resistivity inversion, Three weighted orthogonal vectors (a normal and two tangent vectors) were used to control the resistivity differences at the boundaries of the anomaly. The spatial shape of the anomaly and the constraints on the boundaries of the anomaly are thus established. We incorporated the spatial shape constraints in the objective function of the 3D resistivity inversion and constructed the 3D resistivity inversion equation with spatial shape constraints. Subsequently, we used numerical modeling based on prior spatial shape data to constrain the direction vectors and weights of the 3D resistivity inversion. We established a reasonable range between the direction vectors and weights, and verified the feasibility and effectiveness of using spatial shape prior constraints in reducing excessive structures and the number of solutions. We applied the prior spatially shape-constrained inversion method to locate the aquifer at the Guangzhou subway. The spatial shape constraints were taken from ground penetrating radar data. The inversion results for the location and shape of the aquifer agree well with drilling data, and the number of inversion solutions is significantly reduced.