What happened

Shares of XPO (XPO -6.22%), the less-than-truckload (LTL) transportation company, were moving higher today after the company delivered better-than-expected results in its second-quarter earnings report.

As of 11:16 a.m. ET on Friday, the stock was up 5.7% after gaining as much as 12.1% earlier in the session.

So what

XPO faced macro headwinds in the second quarter as transportation demand has been soft. Overall revenue came in at $1.92 billion, which was down by 6.5% from the quarter a year ago. The decline was primarily due to a lower fuel surcharge, and that result was slightly below estimates at $1.94 billion.

The company said that shipments per day were higher than the quarter a year ago, a sign that demand is recovering, and it saw that momentum build in July with tonnage and shipments up 4% and 9%, respectively, seemingly in part due to the bankruptcy of rival Yellow, the third-largest LTL carrier in North America. An LTL trucking company carries deliveries from several shippers in one truckload instead of dedicating an entire truck to one company's freight.

Further down the income statement, adjusted operating ratio, which is the inverse of operating margin, deteriorated from 83.2% to 87.6% in North American LTL, but improved sequentially. Adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) were also down from $289 million to $244 million.

Adjusted earnings per share slipped from $1.14 to $0.71, which topped the consensus at $0.61.

CEO Mario Harik said, "We sequentially improved our adjusted operating ratio more than our forecast, and operated with greater labor efficiency."

Now what

XPO shares have more than doubled this year in part due to investors' belief that Yellow's collapse will open up market share for peers like Saia and Old Dominion Freight Line, as well as XPO.

The July numbers bode well for its momentum from the Yellow bankruptcy, and the improving economy should also give XPO a boost. If it can make the improvements that it's targeting in its operating ratio, there should be a lot of upside potential for profits.