Competing compartment models of different complexities have been used for the quantitative analysis of dynamic contrast-enhanced magnetic resonance imaging data. We present a spatial elastic net approach that allows to estimate the number of compartments for each voxel such that the model complexity is not fixed a priori. A multi-compartment approach is considered, which is translated into a restricted least square model selection problem. This is done by using a set of basis functions for a given set of candidate rate constants. The form of the basis functions is derived from a kinetic model and thus describes the contribution of a specific compartment. Using a spatial elastic net estimator, we chose a sparse set of basis functions per voxel, and hence, rate constants of compartments. The spatial penalty takes into account the voxel structure of an image and performs better than a penalty treating voxels independently. The proposed estimation method is evaluated for simulated images and applied to an in vivo dataset.