  The 30 Doradus star-forming region in the Large Magellanic Cloud is a nearby
analogue of large star-formation events in the distant Universe. We determine
the recent formation history and the initial mass function (IMF) of massive
stars in 30 Doradus based on spectroscopic observations of 247 stars more
massive than 15 solar masses ($\mathrm{M}_\odot$). The main episode of massive
star formation started about $8\,\mathrm{Myr}$ ago and the star-formation rate
seems to have declined in the last $1\,\mathrm{Myr}$. The IMF is densely
sampled up to $200\,\mathrm{M}_\odot$ and contains $32\pm12\%$ more stars above
$30\,\mathrm{M}_\odot$ than predicted by a standard Salpeter IMF. In the mass
range $15-200\,\mathrm{M}_\odot$, the IMF power-law exponent is
$1.90^{+0.37}_{-0.26}$, shallower than the Salpeter value of 2.35.
