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 th...