  We introduce and analyze a discontinuous Petrov-Galerkin method with optimal
test functions for the heat equation. The scheme is based on the backward Euler
time stepping and uses an ultra-weak variational formulation at each time step.
We prove the stability of the method for the field variables (the original
unknown and its gradient weighted by the square root of the time step) and
derive a C\'ea-type error estimate. For low-order approximation spaces this
implies certain convergence orders when time steps are not too small in
comparison with mesh sizes. Some numerical experiments are reported to support
our theoretical results.
