A military alliance between Russia and Iran to back Syrian President Bashar al-Assad is giving way to an economic rivalry as Syria’s war winds down, a contest Moscow is leading.

The friction is adding pressure on Tehran as U.S. sanctions squeeze Iran’s economy. Russia’s ascendancy also illustrates the muscular role it is playing in the Middle East through oil diplomacy and strategic economic ties.

Russia...