The Developing Human Connectome Project (dHCP) is an Open Science project which provides the first large sample of neonatal functional MRI (fMRI) data with high temporal and spatial resolution. This data enables mapping of intrinsic functional connectivity between spatially distributed brain regions under normal and adverse perinatal circumstances, offering a framework to study the ontogeny of large-scale brain organisation in humans. Here, we characterise in unprecedented detail the maturation and integrity of resting-state networks (RSNs) at term-equivalent age in 337 infants (including 65 born preterm). First, we applied group independent component analysis (ICA) to define 11 RSNs in term-born infants scanned at 43.5-44.5 weeks postmenstrual age (PMA). Adult-like topography was observed in RSNs encompassing primary sensorimotor, visual and auditory cortices. Among six higher-order, association RSNs, analogues of the adult networks for language and ocular control were identified, but a complete default mode network precursor was not. Next, we regressed the subject-level datasets from an independent cohort of infants scanned at 37-43.5 weeks PMA against the group-level RSNs to test for the effects of age, sex and preterm birth. Brain mapping in term-born infants revealed areas of positive association with age across four of six association RSNs, indicating active maturation in functional connectivity from 37 to 43.5 weeks PMA. Female infants showed increased connectivity in inferotemporal regions of the visual association network. Preterm birth was associated with striking impairments of functional connectivity across all RSNs in a dose-dependent manner; conversely, connectivity of the superior parietal lobules within the lateral motor network was abnormally increased in preterm infants, suggesting a possible mechanism for specific difficulties such as developmental coordination disorder which occur frequently in preterm children. Overall, we find a robust, modular, symmetrical functional brain organisation at normal term age. A complete set of adult-equivalent primary RSNs is already instated, alongside emerging connectivity in immature association RSNs, consistent with a primary-to-higher-order ontogenetic sequence of brain development. The early developmental disruption imposed by preterm birth is associated with extensive alterations in functional connectivity.