We develop a general theory of spatially-variant (SV) mathematical morphology for binary images in the euclidean space. The basic SV morphological operators (that is, SV erosion, SV dilation, SV opening, and SV closing) are defined. We demonstrate the ubiquity of SV morphological operators by providing an SV kernel representation of increasing operators. The latter representation is a generalization of Matheron's representation theorem of increasing and translation-invariant operators. The SV kernel representation is redundant, in the sense that a smaller subset of the SV kernel is sufficient for the representation of increasing operators. We provide sufficient conditions for the existence of the basis representation in terms of upper-semicontinuity in the hit-or-miss topology. The latter basis representation is a generalization of Maragos' basis representation for increasing and translation-invariant operators. Moreover, we investigate the upper-semicontinuity property of the basic SV morphological operators. Several examples are used to demonstrate that the theory of spatially-variant mathematical morphology provides a general framework for the unification of various morphological schemes based on spatially-variant geometrical structuring elements (for example, circular, affine, and motion morphology). Simulation results illustrate the theory of the proposed spatially-variant morphological framework and show its potential power in various image processing applications.