Can public preschool education improve early learning outcomes and narrow socioeconomic gaps in academic performance in developing countries? This paper presents quasi-experimental evidence from an expansion of a national preschool program in Peru on learning outcomes. We exploit within family variation in exposure to preschool due to the gradual expansion of preschools across Peru. We find that having access to a regular preschool improves second grade standardized test scores for reading comprehension and mathematics. Exploring mechanisms, we look at two different preschool modalities rolled out in Peru: regular preschools and community preschools (in which local mothers deliver the service with limited supervision), which are assigned to towns based on the number of preschool-aged students in each town. We exploit discontinuities in this assignment rule through a regression discontinuity design and find some evidence that being assigned to a preschool with a trained teacher and proper infrastructure has a positive impact on student learning for students in towns near the cut-off, which suggests that the quality of the preschool matters. Finally, we find that despite contributions to learning, having access to preschool appears to widen rather than close socioeconomic gaps in early achievement, so that complementary measures targeting the poorest students are necessary for greater educational equity.