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 (Embedded Image). 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 Embedded Image and contains 32 \ub1 12% more stars above 30 Embedded Image than predicted by a standard Salpeter IMF. In the mass range of 15 to 200 Embedded Image, the IMF power-law exponent is Embedded I...