The Moon is thought to have formed through the consolidation of debris from the collision of a Mars-sized body with the Earth more than 4,500million years ago. The primitive Moon was covered with a thick layer of melt known as the lunar magma ocean, the crystallization of which resulted in the Moon's surface as it is observed today. There is considerable debate, however, over the precise timing and duration of the process of magma ocean crystallization. Here we date a zircon from lunar breccias to an age of 4,417+/-6million years. This date provides a precise younger age limit for the solidification of the lunar magma ocean. We propose a model that suggests an exponential rate of lunar crystallization, based on a combination of this oldest known lunar zircon and the age of the Moon-forming giant impact. We conclude that the formation of the Moon's anorthositic crust followed the solidification of 80-85% of the original melt, within about 100million years of the collision. The existence of younger zircons is indicative of the continued solidification of a small percentage of melt for an extra 200-400million years.