In this paper, we establish the solvability conditions and the formula of the general solution to a Sylvester-like quaternion matrix equation. As an application, we give some necessary and sufficient conditions for a system of quaternion matrix equations to be consistent, and present an expression of the general solution of the system when it is solvable. We present an algorithm and an example to illustrate the main results of this paper. The findings of this paper generalize the known results in the literature.