In this paper we establish conditions which ensure that a feasible point is a global minimizer of a quadratic minimization problem subject to box constraints or binary constraints. In particular, we show that our conditions provide a complete characterization of global optimality for non-convex weighted least squares minimization problems. We present a new approach which makes use of a global subdifferential. It is formed by a set of functions which are not necessarily linear functions, and it enjoys explicit descriptions for quadratic functions. We also provide numerical examples to illustrate our optimality conditions.