  We present the next-to-next-to-next-to-leading ${\cal O}(\alpha_s^5m_q)$
result for the ground state energy of a heavy quarkonium system. On the basis
of this result we determine the bottom quark mass from $\Upsilon(1S)$ resonance
and provide an explicit formula relating the top quark mass to the resonance
energy in $t\bar t$ threshold production.
