The criterion for the correct spatial alignment is a key component in image registration. We formulate the registration problem as one that finds the spatial and intensity mappings of minimal complexity that make images exactly equal. We do not assume any parametric forms of these functions, and estimate them within variational calculus. We analytically solve for non-stationary intensity mapping, eliminate it from the objective function and arrive with a new similarity measure. We name it the Mapping Complexity (MC) similarity measure, because it achieves the optimum when intensity and spatial mappings are of minimal complexity. Due to its general formulation, the similarity measure works both for complex intensity relationships (e.g. multimodal registration) and for spatially-varying intensity distortions. Our similarity measure can be interpreted as the one that favors one image to lie mostly within a span of the leading eigenvectors of the kernel matrix, where the kernel matrix is constructed from the second image. We introduce a fast algorithm to compute the similarity measure. In particular, we introduce a fast kernel vector product (FKVP) algorithm, which is of general interest in computer vision. We demonstrate the accuracy of the new similarity measure on several mono- and multi-modal examples with complex intensity non-uniformities.