The steady-state interaction of acoustic–gravity waves in an ocean of uniform depth is researched theoretically by means of the homotopy analysis method (HAM), an analytic approximation method for nonlinear problems. Considering compressibility, a hydroacoustic wave can be produced by the interaction of two progressive gravity waves with the same wavelength travelling in opposite directions, which contains an infinite number of small denominators in the framework of the classical analytic approximation methods, like perturbation methods. Using the HAM, the infinite number of small denominators are avoided once and for all by means of choosing a proper auxiliary linear operator. Besides, by choosing a proper ‘convergence-control parameter’, convergent series solutions of the steady-state acoustic–gravity waves are obtained in cases of both non-resonance and exact resonance. It is found, for the first time, that the steady-state resonant acoustic–gravity waves widely exist. In addition, the two primary wave components and the resonant hydroacoustic wave component might occupy most of wave energy. It is found that the dynamic pressure on the sea bottom caused by the resonant hydroacoustic wave component is much larger than that in the case of non-resonance, which might even trigger microseisms of the ocean floor. All of these might deepen our understanding and enrich our knowledge of acoustic–gravity waves.