  We prove global existence for solutions arising from small initial data for a
large class of quasilinear wave equations satisfying the `weak null condition'
of Lindblad and Rodnianski, significantly enlarging upon the class of equations
for which global existence is known. In addition to the usual weak null
condition, we require a certain hierarchical structure in the semilinear terms.
Included in this class are the Einstein equations in harmonic coordinates, so a
special case of our results is a new proof of the stability of Minkowski space.
Our proof also applies to the coupled Einstein-Maxwell system in harmonic
coordinates and Lorenz gauge, as well as to various model scalar wave equations
which do not satisfy the null condition. Our proof also applies to the
Einstein(-Maxwell) equations if, after writing the equations as a set of
nonlinear wave equations, we then `forget' about the gauge conditions. The
methods we use allow us to treat initial data which only has a small
`degenerate energy', involving a weight that degenerates at null infinity, so
the usual (unweighted) energy might be unbounded. We also demonstrate a
connection between the weak null condition and geometric shock formation,
showing that equations satisfying the weak null condition can exhibit `shock
formation at infinity', of which we provide an explicit example. The methods
that we use are very robust, including a generalisation of the p-weighted
energy method of Dafermos and Rodnianski, adapted to the dynamic geometry. This
means that our proof applies in a wide range of situations, including those in
which the metric remains close to, but never approaches the flat metric in some
spatially bounded domain, and those in which the `geometric' null infinity and
the `background' null infinity differ dramatically, for example, when the
solution exhibits shock formation at null infinity.
