  We construct an energy-momentum tensor on the lattice which satisfies the
appropriate Ward Identities (WIs) and has the right trace anomaly in the
continuum limit. It is defined by imposing suitable WIs associated to the
Poincare` invariance of the continuum theory. These relations come forth when
the length of the box in the temporal direction is finite, and they take a
particularly simple form if the coordinate and the periodicity axes are not
aligned. We implement the method for the SU(3) Yang--Mills theory discretized
with the standard Wilson action in presence of shifted boundary conditions in
the (short) temporal direction. By carrying out extensive numerical
simulations, the renormalization constants of the traceless components of the
tensor are determined with a precision of roughly half a percent for values of
the bare coupling constant in the range 0<= g^2_0<=1.
