Objectives To quantify the independent risks of neonatal (0-28 days), postneonatal (29-364 days), 1- to 5- and 6- to 30-year mortality by gestational age and investigate changes in survival over time in an Australian birth cohort. Study design Maternal and birth related Western Australian population data (1980-2010) were linked to the state mortality data using a retrospective cohort study design involving 722 399 live-born singletons infants. Results When compared with 39- to 41-week born infants, the adjusted risk ratio for neonatal mortality was 124.8 (95% CI 102.9-151.3) for 24-31 weeks of gestation, 3.4 (95% CI 2.4-4.7) for 35-36 weeks of gestation, and 1.4 (95% CI 1.1-1.8) for 37-38 weeks of gestation. For 24-31 weeks of gestation infants, the adjusted hazard ratio for postneonatal mortality (29-364 days) was 13.9 (95% CI 10.9-17.6), for 1- to 5-year mortality 1.4 (95% CI 0.7-3.0) and for 6- to 30-year mortality 1.3 (95% CI 0.8-2.3). The risk of neonatal and postneonatal mortality for those born preterm decreased over time. Conclusions In Western Australia, late preterm and early term infants experienced higher risk of neonatal and postneonatal mortality when compared with their full-term peers. There was insufficient evidence to show that gestational length was independently associated with mortality beyond 1 year of age. Neonatal and postneonatal mortality improved with each decade of the study period.