Near-Earth asteroids are small (diameters < 10 km), rocky bodies with orbits that approach that of the Earth (they come within 1.3 AU of the Sun). Most have a chance of approximately 0.5% of colliding with the Earth in the next million years. The total number of such bodies with diameters > 1 km has been estimated to be in the range 1,000-2,000, which translates to an approximately 1% chance of a catastrophic collision with the Earth in the next millennium. These numbers are, however, poorly constrained because of the limitations of previous searches using photographic plates. (One kilometre is below the size of a body whose impact on the Earth would produce global effects.) Here we report an analysis of our survey for near-Earth asteroids that uses improved detection technologies. We find that the total number of asteroids with diameters > 1 km is about half the earlier estimates. At the current rate of discovery of near-Earth asteroids, 90% will probably have been detected within the next 20 years.