A new nonlinear integral equation (NLIE) describing the thermodynamics of the Heisenberg spin chain is derived based on the t-W relation of the quantum transfer matrices. The free energy of the system in a magnetic field is thus obtained by solving the NLIE. This method can be generalized to other lattice quantum integrable models. Taking the SU(3)-invariant quantum spin chain as an example, we construct the corresponding NLIEs and compute the free energy. The present results coincide exactly with those obtained via other methods previously.