Between the spring of 2016 and February 2017, shares of Mexican ultra-low-cost carrier Volaris (NYSE:VLRS) lost nearly half of their value as unit revenue came under pressure and the weak peso drove huge cost increases. Fears about potential U.S. policy changes under the Trump administration were a key driver of both of these developments.

However, the peso has regained some ground in the past few months. Meanwhile, Volaris has reduced its capacity growth to regain some pricing power. Finally, fuel prices have started to fall again. As a result, Volaris stock has surged 39% since bottoming out in February -- and it has plenty more upside.

VLRS Chart

Volaris stock performance; data by YCharts.

The plunging peso has been a constant headwind

The vast majority of Volaris' costs -- including fuel, aircraft rent, and maintenance expenses -- are dollar-denominated, so a weaker peso translates directly into higher costs. A substantial chunk of Volaris' revenue is also dollar-denominated, but the company still suffers significantly when the peso weakens.

The peso has been doing just that -- depreciating against the dollar for most of Volaris' time as a public company. In 2013, the average exchange rate was 12.77 pesos per dollar. The exchange rate then averaged 13.30 pesos per dollar in 2014, 15.85 pesos per dollar in 2015, and 18.66 pesos per dollar in 2016. By early 2017, it cost more than 20 pesos to buy a dollar.

The steady depreciation of the peso has been a major cost headwind for Volaris. However, from late 2014 through the middle of 2016, Volaris benefited from plunging oil prices. The resulting year-over-year fuel cost savings offset the company's currency-related cost inflation.

That changed in late 2016, as fuel costs started to climb significantly on a year-over-year basis -- despite remaining fairly low in an absolute sense -- while the peso plunged even further. As a result, cost per available seat mile surged 26.6% higher at Volaris in Q1.

A Volaris plane on the tarmac

Volaris' unit costs surged in Q1 because of the weak peso. Image source: Volaris.

Meanwhile, revenue per available seat mile declined 6.6% year over year because of the timing of Easter and a downturn in some segments of the U.S.-Mexico travel market. In total, Volaris' operating margin plunged by a stunning 30 percentage points in the first quarter, from 16.1% to negative-13.7%.

Volaris gets relief

Volaris' upcoming Q2 earnings report is likely to show a big sequential improvement in profitability. Some of the improvement relates to the Easter shift and capacity cuts on weaker routes, which together should boost unit revenue. Fuel prices have also declined since April.

The outlook for the third quarter, typically the strongest of the year for Volaris, is even better. Since bottoming out at 22 pesos per dollar shortly after Donald Trump's inauguration, the peso has come roaring back. By Thursday evening, it had reached 17.7 pesos per dollar, a 52-week high. For comparison, the exchange rate averaged 18.72 pesos per dollar in Q3 2016.

US Dollar to Mexican Peso Exchange Rate Chart

U.S. dollar to Mexican peso exchange rate; data by YCharts.

In other words, assuming the exchange rate stays roughly stable for the next few months, a stronger peso will help push down Volaris' costs this quarter. With fuel costs also cooperating, Volaris should be able to post strong profitability in Q3 -- and perhaps even a return to profit growth.

The company's long-term future is bright

While Volaris' unit costs have risen quite a bit in the past few quarters, the carrier still has significantly lower costs than its two main competitors. (VivaAerobus has slightly lower unit costs, but it's just a third of Volaris' size.) Furthermore, Volaris works continuously to push its costs even lower. Most notably, it's gradually shifting its fleet toward larger aircraft that have lower unit costs.

In the long run, Volaris could become the most dominant airline in Mexico, thanks to its low costs and its strong brand there. In the next 15 to 20 years, it will have opportunities to grow to be many times its current size, as air travel takes off in Mexico.

If investors start to focus again on Volaris' long-term strength rather than its short-term challenges, Volaris stock could continue to rally.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.