A novel method to study the bulk thermodynamics in lattice gauge theory is proposed on the basis of the Yang-Mills gradient flow with a fictitious time t. The energy density (epsilon) and the pressure (P) of SU(3) gauge theory at fixed temperature are calculated directly on 32^3 x (6,8,10) lattices from the thermal average of the well-defined energy-momentum tensor (T_{mu nu}^R(x)) obtained by the gradient flow. It is demonstrated that the continuum limit can be taken in a controlled manner from the t-dependence of the flowed data.