We show how statistical thermodynamics can be formulated in situations in which thermodynamics applies, while equilibrium statistical mechanics does not. A typical case is, in the words of Landau and Lifshitz, that of partial (or incomplete) equilibrium. One has a system of interest in equilibrium with the environment, and measures one of its quantities, for example its specific heat, by raising the temperature of the environment. However, within the observation time the global system settles down to a state of apparent equilibrium, so that the measured value of the specific heat is different from the equilibrium one. In such cases formulae for quantities such as the effective specific heat exist, which are provided by Fluctuation Dissipation theory. However, what is lacking is a proof that internal energy exists, i.e., that the fundamental differential form δQ−δW (difference between the heat absorbed by the system and the work performed by it) is closed. Here we show how the coefficients of the fundamental form can be expressed in such a way that the closure property of the form becomes manifest, so that the first principle is proven. We then show that the second principle too follows, and indeed as a consequence of microscopic time-reversibility. The treatment is given in a classical Hamiltonian setting. One has a global time-independent Hamiltonian system constituted by the system of interest and two auxiliary ones controlling temperature and pressure, and the occurring of a process due to a change in the thermodynamic parameters is implemented by a suitable choice of the measure for the initial data.