  We present a new method to measure the work $w$ performed on a driven quantum
system and to sample its probability distribution $P(w)$. The method is based
on a simple fact that remained unnoticed until now: Work on a quantum system
can be measured by performing a generalized quantum measurement at a single
time. Such measurement, which technically speaking is denoted as a POVM
(positive operator valued measure) reduces to an ordinary projective
measurement on an enlarged system. This observation not only demystifies work
measurement but also suggests a new quantum algorithm to efficiently sample the
distribution $P(w)$. This can be used, in combination with fluctuation
theorems, to estimate free energies of quantum states on a quantum computer.
