Let B be a fixed rational function of one complex variable of degree at least two. In this paper, we study solutions of the functional equation A • X = X • B in rational functions A and X. Our main result states that, unless B is a Lattès map or is conjugate to z ±d or ±T d , the set of solutions is finite, up to some natural transformations. In more detail, we show that there exist finitely many rational functions A 1 , A 2 ,. .. , A r and X 1 , X 2 ,. .. , X r such that the equality A • X = X • B holds if and only if there exists a Möbius transformation μ such that A = μ • A j • μ −1 and X = μ • X j • B •k for some j, 1 ≤ j ≤ r, and k ≥ 1. We also show that the number r and the degrees deg X j , 1 ≤ j ≤ r, can be bounded from above in terms of the degree of B only. As an application, we prove an effective version of the classical theorem of Ritt about commuting rational functions.