In the paper we present an application of the homotopy analysis method for solving the two-phase inverse Stefan problem. In the proposed approach a series is created, having elements which satisfy some differential equation following from the investigated problem. We reveal, in the paper, that if this series is convergent then its sum determines the solution of the original equation. A sufficient condition for this convergence is formulated. Moreover, the estimation of the error of the approximate solution, obtained by taking the partial sum of the considered series, is given. Additionally, we present an example illustrating an application of the described method.