A proof of the second law of thermodynamics is given, starting from elementary quantum mechanics. The theorem proved states that, for a macroscopic body, the state of thermal equilibrium has a larger entropy than any other possible state which is subject to the same external constraints and has the same total energy.