The government began promoting natural gas about a decade ago, and not just in response to American-led sanctions. A big initial reason was the increasingly thick yellow blankets of smog that often engulf greater Tehran and its 12 million inhabitants. That was a result of rising auto sales by domestic carmakers like Iran Khodro and Saipa, which took off as oil revenue began rising sharply around 15 years ago, enriching tens of millions of Iranians.

While rising car ownership fit nicely into the government’s narrative of life as ever-improving after the 1979 Islamic revolution, clouds of smog from increased traffic congestion did not. To deal with the pollution, Iranian government planners found an answer in natural gas and its infrastructure, which was already serving the heating and cooking needs of consumers.

“We already had a network of gas pipes in place all over the country,” said Reza Hajj Hosseini, a spokesman for the Iranian Fuel Distribution and Refinery Company, a subsidiary of the state oil company. “It was relatively inexpensive for us to start offering alternative fuel.”

As a means to counter outside economic pressure, natural gas’s usefulness is clear. Because of its inadequate investment in oil refineries, Iran has long been forced to refine a portion of its own crude at refineries in Europe to satisfy rising domestic demand for gasoline. So when the European Union in July barred gasoline sales to the country, natural gas helped to blunt the blow.

Despite the sanctions against Iran, motorists like Mr. Ahmadi can make their commute for the equivalent of less than a penny a mile using the alternative fuel at subsidized prices. Gasoline is more expensive, especially because government subsidies have been reduced, but it is still incredibly cheap by Western standards: less than $1 a gallon.