The de Haas-van Alphen effect was observed in the underdoped cuprate YBa$_2$Cu$_3$O$_{6.5}$ via a torque technique in pulsed magnetic fields up to 59 T. Above an irreversibility field of $sim$30 T, the magnetization exhibits clear quantum oscillations with a single frequency of 540 T and a cyclotron mass of 1.76 times the free electron mass, in excellent agreement with previously observed Shubnikov-de Haas oscillations. The oscillations obey the standard Lifshitz-Kosevich formula of Fermi-liquid theory. This thermodynamic observation of quantum oscillations confirms the existence of a well-defined, close and coherent, Fermi surface in the pseudogap phase of cuprates.