There is a general consensus that planets form within disks of dust and gas around newly born stars. Details of their formation process, however, are still a matter of ongoing debate. The timescale of planet formation remains unclear, so the detection of planets around young stars with protoplanetary disks is potentially of great interest. Hitherto, no such planet has been found. Here we report the detection of a planet of mass (9.8+/-3.3)MJupiter around TWHydrae (TW Hya), a nearby young star with an age of only 8-10Myr that is surrounded by a well-studied circumstellar disk. It orbits the star with a period of 3.56days at 0.04AU, inside the inner rim of the disk. This demonstrates that planets can form within 10Myr, before the disk has been dissipated by stellar winds and radiation.