The competition between collective quantum phases in materials with strongly correlated electrons depends sensitively on the dimensionality of the electron system, which is difficult to control by standard solid-state chemistry. We have fabricated superlattices of the paramagnetic metal LaNiO3 and the wide-gap insulator LaAlO3 with atomically precise layer sequences. Using optical ellipsometry and low-energy muon spin rotation, superlattices with LaNiO3 as thin as two unit cells are shown to undergo a sequence of collective metalinsulator and antiferromagnetic transitions as a function of decreasing temperature, whereas samples with thicker LaNiO3 layers remain metallic and paramagnetic at all temperatures. Metal-oxide superlattices thus allow control of the dimensionality and collective phase behavior of correlated-electron systems.