2016 has been an up-and-down year for airline stocks. The roller coaster ride continued last month, with numerous airline stocks posting big gains. Shares of American Airlines (NASDAQ:AAL) and United Continental (NASDAQ:UAL) surged 25% and 14%, respectively, during July, according to data from S&P Global Market Intelligence.

AAL Chart

Airlines July stock performance, data by YCharts.

By contrast, their top rival -- Delta Air Lines (NYSE:DAL) -- was limited to a 6% gain in July. Let's take a look at why American Airlines and United Continental soared last month while Delta remained grounded.

The revenue trajectory improves at American Airlines

American Airlines posted the biggest gain of any airline stock last month. Its big bounce was driven in part by signs that its revenue outlook is improving.

On July 12, American announced that it had reached new agreements with its two credit card partners that issue AAdvantage-branded rewards cards. The new agreements have significantly better financial terms. This will boost pre-tax income by about $200 million in the second half of 2016, $550 million in 2017, and $800 million in 2018, according to the company.

The growth in this ancillary revenue stream will add roughly two percentage points to American's unit revenue by 2018. This is already helping to offset lingering fare weakness.

American Airlines is getting a big windfall from a new credit card deal. Image source: American Airlines.

The following day, American Airlines raised its guidance for Q2 passenger revenue per available seat mile (PRASM). Initially, it had predicted that PRASM would fall 6%-8% in Q2; on July 13, it revised that forecast to a 6%-7% decline. Ultimately, American reported a 6.3% PRASM decline for Q2.

American Airlines will post much better unit revenue results in Q3. In late July, management projected that total revenue per available seat mile would decline just 3.5%-5.5% this quarter. Just this week, it raised that forecast. American now expects a total RASM drop of 3%-5% for Q3. It's also cutting future capacity plans in order to get unit revenue growing again.

Thus, American Airlines gave investors plenty of good news last month. Still, it's worth noting that the stock is down about 20% this year. To some extent, last month's gains merely reversed an overreaction to bad news earlier in the year.

AAL Chart

American Airlines YTD Stock Performance, data by YCharts.

United Continental looks for smaller improvements

Compared to American Airlines stock's 25% surge last month, United Continental's 14% gain appears somewhat pedestrian.

United was also lifted by a better-than-feared Q2 unit revenue performance. PRASM declined 6.6% at United Continental last quarter, roughly in line with American Airlines' performance. Investors were relieved the PRASM drop wasn't any greater -- in April, the company had forecast PRASM would sink 6.5%-8.5% in Q2.

However, United doesn't expect much sequential improvement in Q3. The company projects that PRASM will decline 5.5%-7.5% this quarter. At the midpoint, that's roughly in line with its Q2 performance. Because of this mixed performance, United Continental stock didn't rise as much as American Airlines stock during July.

Delta loses some of its luster

Meanwhile, Delta had the most disappointing Q2 earnings report and Q3 guidance among the top three airlines. PRASM declined 4.9% year over year at Delta last quarter. That fell short of the company's April guidance, which called for PRASM to fall just 2.5%-4.5% in Q2.

Unlike its rivals, Delta missed its unit revenue guidance in Q2. Image source: The Motley Fool.

Additionally, Delta doesn't expect meaningful improvement in Q3, with PRASM for the full quarter expected to sink 4%-6% year over year. Moreover, Delta is relying on a big sequential improvement in September to meet that PRASM guidance.

To be fair, Delta still posted the best unit revenue results among the legacy carriers in Q2. But it appears to be sliding toward the middle of the pack now. Thus, it's not too surprising that Delta shares underperformed the rest of the airline industry last month with a 6% gain.

Are the gains sustainable?

American Airlines, Delta Air Lines, and United Continental are all starting to face margin pressure as they lose the benefit of huge year-over-year fuel price declines. That's made it more critical than ever for all three airlines to return to unit revenue growth.

American appears to be making the most progress in that direction, helped by its recent credit card deal. That's why American Airlines stock bounced back in July, following a terrible first-half performance. The outlook is cloudier for United and Delta, leading to smaller gains for those carriers last month.

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.