We study the nonlinear stability of the $(3+1)$-dimensional Minkowski spacetime as a solution of the Einstein vacuum equation. Similarly to our previous work on the stability of cosmological black holes, we construct the solution of the nonlinear initial value problem using an iteration scheme in which we solve a linearized equation globally at each step; we use a generalized harmonic gauge and implement constraint damping to fix the geometry of null infinity. The linear analysis is largely based on energy and vector field methods originating in work by Klainerman. The weak null condition of Lindblad and Rodnianski arises naturally as a nilpotent coupling of certain metric components in a linear model operator at null infinity. Upon compactifying $mathbb{R}^4$ to a manifold with corners, with boundary hypersurfaces corresponding to spacelike, null, and timelike infinity, we show, using the framework of Melroses b-analysis, that polyhomogeneous initial data produce a polyhomogeneous spacetime metric. Finally, we relate the Bondi mass to a logarithmic term in the expansion of the metric at null infinity and prove the Bondi mass loss formula.