The 30 Doradus star-forming region in the Large Magellanic Cloud is a nearby analog of large star-formation events in the distant universe. We determined the recent formation history and the initial mass function (IMF) of massive stars in 30 Doradus on the basis of spectroscopic observations of 247 stars more massive than 15 solar masses (). The main episode of massive star formation began about 8 million years (My) ago, and the star-formation rate seems to have declined in the last 1 My. The IMF is densely sampled up to 200 and contains 32 ± 12% more stars above 30 than predicted by a standard Salpeter IMF. In the mass range of 15 to 200 , the IMF power-law exponent is , shallower than the Salpeter value of 2.35.