This paper presents the method and performance of primary vertex reconstruction in proton-proton collision data recorded by the ATLAS experiment during Run 1 of the LHC. The studies presented focus on data taken during 2012 at a centre-of-mass energy of root s = 8 TeV. The performance has been measured as a function of the number of interactions per bunch crossing over a wide range, from one to seventy. The measurement of the position and size of the luminous region and its use as a constraint to improve the primary vertex resolution are discussed. A longitudinal vertex position resolution of about 30 mu m is achieved for events with high multiplicity of reconstructed tracks. The transverse position resolution is better than 20 mu m and is ...