United Continental (NYSE:UAL) has been a perennial laggard in the airline industry in recent years, with a pre-tax margin well below that of Delta Air Lines (NYSE:DAL). A few years ago, the company installed a new management team with the goal of closing that margin gap. After some initial struggles, United's turnaround strategy has finally started to gain traction in 2018.

On Tuesday afternoon, the company reported better-than-expected results for the second quarter of 2018, along with solid guidance for the third quarter and full year. This good news sparked a 9% rally for United Continental stock on Wednesday.

Margin pressure continues -- but it could have been worse

Entering the second quarter, United Airlines projected that it would post a 1% to 3% increase in passenger revenue per available seat mile (PRASM). While this was better than what some analysts had projected, it was clearly not going to be enough to offset the full impact of rising fuel costs. United estimated that its adjusted pre-tax margin would slip to a range of 9% to 11%, compared to 13.2% a year earlier.

Fuel prices rose even more than initially expected during the second quarter, reaching $2.26 per gallon, up 39% year over year. However, PRASM jumped 3%, reaching the high end of United's forecast range. International markets performed particularly well.

A United Airlines plane flying over a coastline

United Airlines posted solid unit revenue growth last quarter. Image source: United Airlines.

As a result, United Airlines managed to post an adjusted pre-tax margin of 10.4% last quarter (in the upper half of its guidance range). Adjusted earnings per share rose to $3.23 from $2.76 a year earlier, driven by share buybacks and the reduction of the federal corporate tax rate. On average, Wall Street analysts had expected EPS of $3.07.

United's adjusted pre-tax margin fell by 2.8 percentage points last quarter, compared to a 2.9-percentage-point decline at Delta. Considering that United's accelerated capacity growth raised the risk of short-term margin pressure, holding the margin gap with Delta steady was a big accomplishment.

Strong guidance as well

Looking ahead to the third quarter, United Airlines projected that unit revenue growth will accelerate, with PRASM up 4% to 6% year over year. Meanwhile, fuel costs are expected to be up substantially year over year once again, but nonfuel unit costs are on track to decline slightly.

The net result is that United's adjusted pre-tax margin will likely come in between 8% and 10%, down from 10.4% in the year-ago period. If a recent pullback in oil prices continues, there could be upside to that forecast.

Additionally, United Airlines raised its full-year EPS forecast for the second time this year. The original guidance range was $6.50-$8.50. United updated that to $7.00-$8.50 in April and $7.25-$8.75 in conjunction with its Q2 earnings report. The carrier also tweaked its full-year capacity guidance. It now plans to grow 4.5%-5%, down from its prior forecast of 4.5%-5.5% growth.

Delta still looks like a better investment

There wasn't anything to complain about in United's second-quarter earnings report. However, while it is now keeping pace with Delta (on a relative basis), it still isn't clear that it has the wherewithal to close the long-standing margin gap.

Indeed, Delta's adjusted pre-tax margin was nearly 4 percentage points ahead of United's in the first half of 2018. For the third quarter, Delta Air Lines expects to post a 12% to 14% pre-tax margin, once again ahead of United Airlines by about 4 percentage points.

To be fair, United Airlines' market cap is considerably lower, so the two companies trade for similar earnings multiples. However, Delta has less debt, and its higher profit margin makes it a less risky investment and should justify a higher earnings multiple. United Airlines is gradually stabilizing its profitability -- which is certainly a good sign -- but as long as the margin gap remains intact, Delta Air Lines stock is likely to be a better long-term investment.

Adam Levine-Weinberg owns shares of Delta Air Lines. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.