Let Ω⊂Rn be a convex polytope (n≤3). The Ritz projection is the best approximation, in the W01,2-norm, to a given function in a finite element space. When such finite element spaces are constructed on the basis of quasiuniform triangulations, we show a pointwise estimate on the Ritz projection. Namely, that the gradient at any point in Ω is controlled by the Hardy--Littlewood maximal function of the gradient of the original function at the same point. From this estimate, the stability of the Ritz projection on a wide range of spaces that are of interest in the analysis of PDEs immediately follows. Among those are weighted spaces, Orlicz spaces and Lorentz spaces.