It's been a challenging couple years for Copa Holdings (NYSE:CPA), owner of Panama-based Copa Airlines. During this time, many of the company's most important markets -- in particular, Venezuela, Colombia and Brazil -- have suffered from weak economies and currency devaluations that caused demand for Copa's fares to drop precipitously. However, the company's third quarter earnings report left many investors feeling much better about the airline's prospects heading into 2017, with CEO Pedro Heilbron remarking:

During this third quarter, we saw a clear improvement versus 2015 and the first half of 2016, and believe that the worst is behind us. We are still operating in a soft yield environment, but the year-over-year gap is narrowing. And with a visibly stronger demand environment and more stable Latin American currencies, we believe it's only a matter of time until we see strengthening yields.

Let's look at why the clouds surrounding Copa's stock appear to have lifted.

A Copa Airlines plane in flight


A long-awaited return to top-line growth


Copa experienced unit revenue declines for two full years as a perfect storm of economic slowdowns and currency headwinds throughout South America wreaked havoc on passenger demand. And as recently as 2016's first quarter, the company was still experiencing double-digit year-over-year decreases in total revenue. At last, Copa appears to have turned the corner in the third quarter of 2016, posting total revenue of $569 million, a 4% increase over the prior year . Copa CEO Pedro Heilbron attributed this turnaround to the company's impressive 84.2% quarterly load factor -- the percentage of total seats that were filled -- which helped offset weak passenger yields.

Given initial guidance for 2017 capacity growth of 5%, improving operating conditions in Copa's markets, and the fact that the company will be lapping some pretty awful results for the next couple quarters, revenue growth seems very likely to continue throughout 2017.

Strengthening operating margins


Copa is a well-run airline that, up until the past couple of years, regularly boasted high operating margins north of 17%. Even during the depths of the company's struggles, it has always remained profitable. However, margins did suffer, reaching lows of around 7% in two of the previous four quarters. But the year-over-year trend is unmistakably positive for the past three quarters, and the company finally posted a year-over-year increase in its most recent quarter, with reported margins of 13.6%.

Copa is also convinced that better days lie ahead. Going forward, the company raised its full-year 2016 operating margin guidance -- now 12% to 13% -- and offered initial 2017 guidance of 15% to 17%. Heilbron also stated that the company has a plan to get its margins back into the "high teens" over the next couple of years.

Passenger yields may have finally found a bottom


As you might imagine, Copa's passenger yield -- the average fare paid per mile, per passenger -- was crushed during this period of weaker demand. In the third and fourth quarters of 2015, yields decreased more than 20% year-over-year, hitting a low in the second quarter of 2016 of 11.3 cents. However, while third-quarter 2016 yields were still lower year-over-year, the rate of decline slowed considerably and showed sequential improvement compared to the prior quarter, a good sign that demand is beginning to strengthen again.

The days of double digit declines in revenue and yields appear to be over for now and management seems confident in their initial outlook for 2017. While Copa's shares have already increased more than 100% from their 2016 lows, as long as demand continues to improve and the economies in Copa's key markets stabilize, higher profits should follow. Copa will be reporting its fourth quarter and full year 2016 results on Feb. 16. Investors who have hung in there during the past several quarters should have plenty to look forward to in the year ahead.