The inverse scaling and squaring algorithm computes the logarithm of a square matrix $A$ by evaluating a rational approximant to the logarithm at the matrix $B:=A^{2^{-s}}$ for a suitable choice of $s$. We introduce a dual approach and approximate the logarithm of $B$ by solving the rational equation $r(X)=B$, where $r$ is a diagonal Padé approximant to the matrix exponential at $0$. This equation is solved by a substitution technique in the style of those developed by Fasi & Iannazzo (2020, Substitution algorithms for rational matrix equations. Elect. Trans. Num. Anal., 53, 500–521). The new method is tailored to the special structure of the diagonal Padé approximants to the exponential and in terms of computational cost is more efficient than the state-of-the-art inverse scaling and squaring algorithm.