In this paper, an explicit a posteriori error estimator is developed for second and
fourth order ODEs solved with the Galerkin method that, remarkably, provides exact pointwise
error estimates. The error estimator is derived from the variational multiscale theory, in which
the subgrid scales are approximated making use of fine-scale Green's functions. This methodology
can be extended to any element type and order. Second and fourth order differential equations
cover a great variety of problems in mechanics. Two examples with application in elasticity have
been studied: the axially loaded beam and the Euler-Bernoulli beam. Because the error estimator
is explicit, it can be very easily implemented and its computational cost is very small. Apart from
pointwise error estimates, we present local and global a posteriori error estimates in the $L^1$-norm,
the $L^2$-norm and the $H^1$-seminorm. Finally, convergence rates of the error and the efficiencies of
the estimator are analyzed.