This paper introduces the Nystr\om PCG algorithm for solving a symmetric positive-definite linear system. The algorithm applies the randomized Nystr\om method to form a low-rank approximation of the matrix, which leads to an efficient preconditioner that can be deployed with the conjugate gradient algorithm. Theoretical analysis shows that preconditioned system has constant condition number as soon as the rank of the approximation is comparable with the number of effective degrees of freedom in the matrix. The paper also develops adaptive methods for achieving similar performance without knowledge of the effective dimension. Numerical tests show that Nystr\om PCG can rapidly solve large linear systems that arise in data analysis problems, and it surpasses several competing methods from the literature.