The two leaders said the new pipeline was of international significance
Turkmenistan has opened a second gas pipeline to Iran, further eroding Russia's historical domination of its energy sector.
The new pipeline will eventually more than double Turkmenistan's annual gas exports to Iran to 20bn cubic metres.
With a pipeline to China that opened last month, sales to Russia will be a much smaller proportion of exports.
The EU also wants to build a gas link that bypasses Russia, which for now remains the main buyer of Turkmen gas.
Iranian President Mahmoud Ahmadinejad inaugurated the new 30km (19 miles) pipeline with Turkmen President Kurbanguly Berdymukhamedov in a ceremony in the desert near the Iranian border.
The two jointly turned a spigot to symbolically open the link, which will deliver gas from the Dovletabad field to Iran's Khangiran refinery.
"This pipeline will be a good stimulus for energy co-operation between Turkmenistan and Iran, as well as for delivery of Turkmen gas to the Persian Gulf and the world market," Mr Ahmadinejad said.
The new pipelines have given Turkmenistan more power in negotiations with Russian energy giant Gazprom, which has now had to agree to pay higher prices for Turkmen gas.
Previously, the bulk of Turkmenistan's gas was transported along Soviet-era pipelines that went through Russia, giving Moscow the power to dictate prices.
Gas supplies to Russia resumed in December after an eight-month dispute over pricing.
Russia will now buy 30bn cubic metres annually, down from 50bn cubic metres before supplies were cut by a pipeline explosion in April.