Throughout its history, Southwest Airlines (LUV 1.19%) has been one of the most profitable companies in the U.S. airline industry. However, among the largest U.S. airlines, Delta Air Lines (DAL 3.05%) began to challenge Southwest in terms of profitability several years ago.

More recently, Southwest Airlines has started to pull away from the pack again. For example, in 2016, it posted a full-year adjusted operating margin of 19.4%, compared to 16.5% for Delta Air Lines. Furthermore, while it is losing some ground right now, Southwest retains a solid margin premium over Delta -- and it is set to expand that advantage next year.

Strong second-quarter results

Last quarter, Southwest Airlines generated a solid 1.5% increase in revenue per available seat mile (RASM). This did lag the unit revenue growth posted by several other airlines, including Delta. Nevertheless, it was a very good result, considering that Southwest faced a much tougher year-over-year comparison; it had posted 0.6% RASM growth in Q2 2016, at a time when unit revenue was falling at most U.S. airlines.

Southwest's unit revenue growth last quarter allowed it to offset most of the cost pressure it has been facing lately. While the company's margins declined modestly on a year-over-year basis, Southwest Airlines still managed to produce an admirable 21.1% adjusted operating margin in Q2. Furthermore, EPS increased slightly, driven by higher revenue and a lower share count.

A Southwest Airlines plane

Southwest eked out modest EPS growth in the second quarter. Image source: Southwest Airlines.

Meanwhile, Delta Air Lines increased its operating margin and posted double-digit EPS growth last quarter, helped by an easy year-over-year comparison. Nevertheless, its 18.4% operating margin lagged that of Southwest by nearly 3 percentage points.

The third-quarter outlook is solid as well

Looking ahead to Q3, Southwest expects RASM to continue rising, this time by about 1% year over year. RASM growth would be around 2%, but for lingering headwinds related to a recent reservation system switch, which also hurt unit revenue in the second quarter.

On the cost side, Southwest Airlines projects that adjusted non-fuel unit costs will rise 2%-3% year over year this quarter. This cost increase will be partially offset by slightly lower fuel prices and improving fuel efficiency.

As a result, Southwest's third-quarter operating margin should be roughly in line with last year's 18.9% result (excluding special items). That would put it in the same range as Delta's guidance for a Q3 operating margin of 18%-20%.

Huge tailwinds coming in 2018

While Delta Air Lines is set to match Southwest Airlines' operating margin this quarter, it will quickly fall back. Southwest is positioned to deliver stellar margin expansion and rapid earnings growth in 2018, as it starts to reap the benefits of its ongoing fleet transition, the new IT system, and better hedging results.

First, Southwest Airlines will stop flying its aging 737-300 fleet at the end of September. At that time, it will stop incurring accelerated depreciation on those planes. Southwest will also benefit from significant fuel cost savings by replacing most of its 737-300s with brand-new, highly fuel-efficient planes.

Second, whereas Southwest's new IT system hurt the company's revenue in Q2 and will do so again in Q3, it will become a big tailwind next year. In fact, Southwest believes that the new reservation system will boost annual operating income by $500 million by 2020.

Third, Southwest Airlines will finally see some fuel cost relief in 2018. Market fuel prices have fallen significantly in the past few years, but Southwest is still paying the price for its aggressive hedging strategy. In the first half of 2017, fuel hedging losses increased Southwest's fuel costs by $0.30 a gallon; in the second half of the year, hedging losses may total $0.35 a gallon.

However, as of now, the company is set to see modest hedging gains in 2018 and beyond. This would provide a roughly 3-percentage-point margin boost relative to 2017.

Including all of these factors, Southwest Airlines' operating margin is likely to fly higher in 2018. Even if Delta Air Lines expands its profit margin as well (as its management team expects), keeping up with Southwest Airlines will be virtually impossible.