It is shown that the variational derivative of the integral of Branson's Q-curvature is the ambient obstruction tensor of Fefferman-Graham. A classification of irreducible conformally invariant tensors modulo quadratic and higher degree terms in curvature is established.