Let $\mathcal{K}$ be an arbitrary root class of groups. This means that $\mathcal{K}$ contains at least one non-unit group, is closed under taking subgroups and direct products of a finite number of factors and satisfies the Gruenberg condition: if $1 \leqslant Z \leqslant Y \leqslant X$ is a subnormal series of a group $X$ such that $X/Y \in \mathcal{K}$ and $Y/Z \in \mathcal{K}$, there exists a normal subgroup $T$ of $X$ such that $T \subseteq Z$ and $X/T \in \mathcal{K}$. In this paper we study the property `to be residually a $\mathcal{K}$-group' of an HNN-extension in the case when its associated subgroups coincide. Let $G = (B,\ t;\ t^{-1}Ht = H,\ \varphi)$. We get a sufficient condition for $G$ to be residually a $\mathcal{K}$-group in the case when $B \in \mathcal{K}$ and $H$ is normal in $B$, which turns out to be necessary if $\mathcal{K}$ is closed under factorization. We also obtain criteria for $G$ to be residually a $\mathcal{K}$-group provided that $\mathcal{K}$ is closed under factorization, $B$ is residually a $\mathcal{K}$-group, $H$ is normal in $B$ and satisfies at least one of the following conditions: $\operatorname{Aut}_G(H)$ is abelian (we denote by $\operatorname{Aut}_G(H)$ the group of all automorphisms of $H$ which are the restrictions on this subgroup of all inner automorphisms of $G$); $\operatorname{Aut}_G(H)$ is finite; $\varphi$ coincides with the restriction on $H$ of an inner automorphism of $B$; $H$ is finite; $H$ is infinite cyclic; $H$ is of finite Hirsh-Zaitsev rank (i. e. $H$ possesses a finite subnormal series all factors of which are either periodic or infinite cyclic). Besides, we find a sufficient condition for $G$ to be residually a $\mathcal{K}$-group in the case when $B$ is residually a $\mathcal{K}$-group and $H$ is a retract of $B$ ($\mathcal{K}$ is not necessarily closed under the factorization in this statement).