Shares of Mexican ultralow-cost carrier Volaris (VLRS 2.36%) surged from around $9 at the beginning of 2015 to a high above $21 in April 2016. However, in the past six months, Volaris stock has given up some of its gains.

VLRS Chart

Volaris Stock Performance data by YCharts.

The problem isn't demand. Volaris has continued to post steady growth in revenue per available seat mile during 2016, despite growing capacity at a double-digit rate.

Instead, Volaris' biggest problem is the weak peso, which has fallen sharply against the dollar this year, with most of the damage coming since the beginning of May. Since most of Volaris' expenses are dollar-denominated, the weak peso is driving cost inflation, pressuring profitability. However, this doesn't make Volaris any less compelling as a long-term investment.

The weak peso starts to have an impact

The peso's decline didn't just begin six months ago. It has been steadily losing value against the dollar since 2014, driven by a variety of factors, including expected interest rate increases in the U.S., GDP disappointments in Mexico, and economic weakness in other emerging markets.

US Dollar to Mexican Peso Exchange Rate Chart

US Dollar to Mexican Peso Exchange Rate data by YCharts.

In 2015, falling fuel prices more than made up for the peso's weakness. For the full year, Volaris' cost per available seat mile (CASM) excluding fuel rose 8.8% year over year. However, including the impact of fuel, CASM declined 4.6%, contributing to a huge jump in Volaris' profit margin.

The benefit from lower fuel prices has faded in 2016. In Q2, Volaris reported a 5.9% increase in CASM, even after including the benefit of lower fuel prices. That led to modest margin contraction. With fuel prices now on the rise and the peso continuing to decline in value, Volaris will see even steeper cost inflation in the second half of the year.

Volaris continues to focus on reducing unit costs

The exchange rate is outside of Volaris' control, so management is focusing on keeping costs as low as possible. For example, Volaris has increased its aircraft utilization in order to spread its fixed aircraft lease costs over more passengers. It is also shifting its fleet toward larger planes that are cheaper to operate on a per-seat basis, such as the A321.

Additionally, Volaris took delivery of its first A320neo from Airbus last month. The A320neo is about 15% more fuel efficient than the A320, and while much of the fuel cost savings may be offset by higher lease rates, it provides a useful hedge against higher oil prices. Volaris is also using a new seating configuration to squeeze an extra row of seats into each A320neo, relative to its A320s. This will further reduce its unit costs.

Volaris is reducing its unit costs by replacing its A319s with larger planes. Image source: The Motley Fool.

In total, the more cost-efficient A320neo, A321, and A321neo will represent more than 40% of Volaris' fleet and roughly 45% of its seat count by the end of 2018. This, combined with the benefits of scale, should enable Volaris to maintain its industry-leading unit costs.

Mitigating the weak peso's effects -- and hoping for a comeback

The weak peso is driving cost inflation for all of Mexico's airlines. Meanwhile, air travel demand has been growing at a steady pace. This creates a favorable backdrop for airlines to raise fares to offset rising costs.

Delta Air Lines' (DAL -2.62%) pending joint venture with top Mexican airline Aeromexico will help in this respect. The two carriers expect to receive antitrust immunity by year's end, allowing Delta to raise its stake in Aeromexico to as much as 49%. Delta plans to take an active role in guiding Aeromexico's strategy going forward, including pushing it to focus on serving business travelers. That would lead to less competition for the leisure travelers Volaris serves.

Volaris can also mitigate the peso's slump by expanding in the U.S. Volaris prices its flights to the U.S. in dollars, so adding transborder flights would bring in more dollar-denominated revenue to offset dollar-denominated costs.

The liberalized U.S.-Mexico aviation treaty implemented in August will open up even more transborder route opportunities for Volaris. Volaris plans to add several new routes to the U.S. in the coming months, while also adding flight frequencies on some of its existing U.S. routes.

Thus, Volaris should be able to remain solidly profitable despite cost pressure from the falling peso, although earnings growth will be hard to achieve in the near term. In the long run, the peso will stabilize against the dollar and perhaps even regain some ground. At that point, Volaris will be well positioned to resume its trajectory of strong earnings growth. Investors would be wise to stick around.