We study the outer automorphism group of a right-angled Artin group AΓ with finite defining graph Γ. We construct a subnormal series for Out(AΓ) such that each consecutive quotient is either finite, free-abelian, GL(n, Z) or a Fouxe-Rabinovitch group. The last two types act, respectively, on a symmetric space or a deformation space of trees, so that there is a geometric way of studying each piece. As a consequence we prove that the group Out(AΓ) is type VF (it has a finite index subgroup with a finite classifying space).The main technical work is a study of relative outer automorphism groups of RAAGs and their restriction homomorphisms, refining work of Charney, Crisp and Vogtmann. We show that the images and kernels of restriction homomorphisms are always simpler examples of relative outer automorphism groups of RAAGs. We also give generators for relative automorphism groups of RAAGs, in the style of Laurence's theorem.