In sizing up the top three U.S. airlines in terms of profitability, Delta Air Lines (DAL -0.06%) has been the clear winner for some time. That has left American Airlines (AAL 0.94%) and United Continental (UAL 5.50%) to compete for second place.

United Airlines has been the least profitable major airline recently. Image source: The Motley Fool.

Back in October, both American and United gave fairly downbeat margin forecasts for Q4. However, conditions have improved as the quarter has progressed, leading both companies to raise their forecasts significantly.

Airline investors get a scare

Airlines' profits have soared since late 2014 because of the collapse of oil prices. However, some of the cost savings have been offset by unit revenue declines. Over the past two years, many investors have worried that this downward unit revenue trend would negatively affect airline profit margins once oil prices stabilized.

Oil prices bottomed out earlier this year, so most airlines are facing year-over-year fuel price increases now. Sure enough, profitability is starting to erode for both American Airlines and United Continental.

Early in the quarter, United Continental projected a fairly steep 4%-6% unit revenue decline for Q4. American Airlines expected a relatively moderate 1%-3% decrease in revenue per available seat mile (RASM), but it's currently plagued by runaway costs. The net result was the same in both cases: a sharp plunge of their pre-tax profit margins into single-digit territory.

American Airlines forecast that it would post a 4%-6% pre-tax margin in Q4, down from 13.4% in Q4 2015. United's guidance wasn't much better: It forecast that its pre-tax margin would slip to a range of 5%-7% from 10.4% a year earlier.

Demand is bouncing back

Fortunately for American Airlines and United Continental shareholders, air travel demand is finally strengthening. This is driving better-than-expected revenue results across the industry. A month ago, American Airlines bumped up its RASM guidance range by 0.5 percentage points and raised its pre-tax margin guidance to a range of 5%-7%.

American Airlines has raised its Q4 margin guidance twice since November. Image source: American Airlines.

Last week, investors got even more good news. American Airlines now expects RASM to be roughly flat year over year in Q4, plus or minus 1 percentage point. As a result, it revised its pre-tax margin guidance to a range of 6%-8%, up a full 2 percentage points since late October.

The outlook is also improving at United Continental, which now estimates that unit revenue will decline 3%-4% this quarter. That improvement allowed United to raise its pre-tax margin guidance to a range of 7.5%-8.5%, putting it slightly ahead of American Airlines again.

This will be the second straight quarter that both American and United post unit revenue results at or above the high end of their original guidance ranges. That's an encouraging sign for investors weary of the airlines' long string of unit revenue declines.

Delta remains the leader

Two months ago, Delta Air Lines projected that its Q4 operating margin would be 14%-16%. That outlook implied that its pre-tax margin would be roughly 13%-15%. Thus, Delta expected its Q4 profit margin to be more than double those of its two main rivals.

Delta is still the most profitable of the legacy carriers. Image source: Delta Air Lines.

Since then, American and United have both raised their margin forecasts. By contrast, Delta recently slashed its operating margin guidance range to 9.5%-10.5% after handing out big pay raises to its pilots.

However, as part of their new contract, Delta's pilots will receive $380 million of retroactive pay this quarter. Excluding this retroactive pay, Delta's profit margin would be about 4 percentage points higher. Thus, on a like-for-like basis, Delta Air Lines remains well above American Airlines and United Continental in terms of profitability.

Delta will probably lose some ground to its two main rivals this quarter. That's not too surprising, considering it faced the toughest year-over-year revenue comparisons.

That said, as revenue comparisons get easier for Delta in the coming year, its unit revenue performance is likely to improve dramatically. The industry's nascent revenue recovery is mitigating what would otherwise be substantial margin declines at American Airlines and United Continental. But they will still be fighting for second place for the foreseeable future.