The D-gap function, recently introduced by Peng and further studied by Yamashita et al., allows a smooth unconstrained minimization reformulation of the general variational inequality problem. This paper is concerned with the D-gap function for variational inequality problems over a box or, equivalently, mixed complementarity problems. The purpose of this paper is twofold. First we investigate theoretical properties in depth of the D-gap function, such as the optimality of stationary points, bounded level sets, global error bounds and generalized Hessians. Next we present a nonsmooth Gauss–Newton type algorithm for minimizing the D-gap function, and report extensive numerical results for the whole set of problems in the MCPLIB test problem collection.