This paper deals with the mortar spectral element discretization of two equivalent problems, the Laplace equation and the Darcy system, in a domain which corresponds to a nonhomogeneous anisotropic medium. The numerical analysis of the discretization leads to optimal error estimates and the numerical experiments that we present enable us to verify its efficiency.