In this paper, we develop a spatially-variant (SV) mathematical morphology theory for gray-level signals and images in the Euclidean space. The proposed theory preserves the geometrical concept of the structuring function, which provides the foundation of classical morphology and is essential in signal and image processing applications. We define the basic SV gray-level morphological operators (that is, SV gray-level erosion, dilation, opening, and closing) and investigate their properties. We demonstrate the ubiquity of SV gray-level morphological systems by deriving a kernel representation for a large class of systems, called V-systems, in terms of the basic SV gray-level morphological operators. A V-system is defined to be a gray-level operator, which is invariant under gray-level (vertical) translations. Particular attention is focused on the class of SV flat gray-level operators. The kernel representation for increasing V-systems is a generalization of Maragos' kernel representation for increasing and translation-invariant function-processing systems. A representation of V-systems in terms of their kernel elements is established for increasing and upper semicontinuous V-systems. This representation unifies a large class of spatially-variant-linear and nonlinear systems under the same mathematical framework. The theory is used for analyzing special cases of signal and image processing systems such as SV order rank filters and ' linear-time-varying systems. Finally, simulation results show the potential power of the general theory of gray-level SV mathematical morphology in several image analysis and computer vision applications.