The electric-field spatial gradient is a very important property of an optical near-field (ONF). In this study, its effect on the single-photon ionization is theoretically investigated via the three-dimensional time-dependent Schrödinger equation and perturbation theory. The results show that the field gradient can lead to dipole-forbidden transitions, which competes with the usual dipole transition and results in changes of the photoelectron momentum distribution. Additionally, we establish a relationship between the field gradient with the angular distribution of the photoelectrons. Through this mapping, the field gradient can be accurately retrieved. Furthermore, a way for extracting the phase difference between the partial waves with odd and even parity from the photoelectron momentum distribution is proved to be feasible. We find that the Cooper minimum can enhance the effect of the field gradient and thus improves the accuracy of our proposed retrieval procedure. Our results pave the way to exploit atomic structural properties as a probe of the gradient of the ONF.