XPO Logistics (XPO -2.78%) and C.H. Robinson Worldwide (CHRW 0.84%) are two of the largest and most well-respected companies in the business of helping their clients move goods through the supply chain and out to customers. But the two stocks have been moving in opposite directions this year, with XPO up more than 40% year to date and shares of C.H. Robinson down more than 10%.

Part of XPO's surge higher is a relief rally after a poor end to 2018, but the company is holding up well in what has been a difficult year for the transportation sector. A combination of fears of a global slowdown, trade wars and tariffs, and falling corporate confidence has eaten into growth and put pressure on truckers and other shipping companies.

XPO Chart

XPO vs. CHRW data by YCharts.

The Cass Freight Index, a measure of North American freight volumes and expenditures, has trended down year over year throughout 2019, and recent data suggest the contraction is getting worse, with two years of growth now erased.

Is C.H. Robinson a bargain now after recent declines, or is XPO the better stock to pick for investors interested in buying in and riding out the storm? Here's a look at the two companies to determine which, if either, is the better buy today.

XPO: Back in the fast lane

XPO shares gained an incredible 3,000% over a 10-year period ending in mid-2018, but the stock hit the brakes and went into reverse due to a series of setbacks including a critical short-seller report, followed soon after by a fourth-quarter 2018 earnings miss caused in part by its largest customer taking its business in-house. Over a five-month period spanning the end of 2018 and early 2019, XPO shares lost about half their value.

The problem, in part, was that one customer -- believed to be Amazon.com -- supplied such a large percentage of revenue that its loss could not be easily overcome. In the quarters since, XPO has been focused on diversifying its customer base and building its digital and e-commerce offerings.

A automated supply chain facility.

An XPO supply chain facility. Image source: XPO Logistics.

Amazon left in part because XPO's Direct business is a growing threat to Amazon's scale advantage over e-commerce rivals. Direct is set up to be a shipping back office, providing integrated logistics, transportation, and delivery services at scale to help retailers better compete against Amazon. Contract logistics is a $120 billion and growing market by XPO's estimate, and the company says it only has 5% share today.

XPO Connect is another digital offering that the company hopes will help it gain market share. Connect is a digital freight marketplace that offers improved price transparency and route planning for shippers while giving truckers the ability to reduce the number of empty miles they drive. XPO believes the product is sticky enough that it will cause shippers and truckers to do more business with XPO instead of with rivals.

The initial results are positive. XPO was a rare bright spot in a difficult quarter for transport companies, reporting results that beat analyst estimates and maintaining full-year earnings and free cash flow guidance, thanks in part to success from its tech initiatives.

The missing link for XPO in 2019 has been M&A. CEO Brad Jacobs has built his reputation as a master consolidator, buying more than 500 companies while rolling up the equipment rentals, waste management, and now logistics industries. But XPO took a break from dealmaking last year after its stock cratered, threatening to limit future upside for the shares.

XPO has hinted that it is moving closer to resuming dealmaking and is likely to find good value due to the tough environment for transports. If so, the pieces are in place for XPO to once again become an outperformer.

C.H. Robinson: Stuck in neutral

It's hard to match the mind-numbing long-term gains of XPO, but C.H. Robinson's numbers stack up well against almost anyone else in the transportation sector. The company's shares are up more than 600% so far this century, easily outpacing the S&P 500, and its business is a leading third-party logistics operation.

C.H. Robinson has more than $20 billion in freight under management and handles 18 million shipments annually for 124,000 customers and 76,000 contract carriers, making it the world's largest logistics platform.

A semi truck driving on a highway.

Image source: Getty Images.

Alas, the recent weakness in transports has taken its toll. In late October, C.H. Robinson reported third-quarter revenue down 10.2% year over year and earnings that missed estimates by $0.07 per share, with the company reporting aggressive industry pricing due to excess capacity and softening demand. Operating margin in the quarter fell 370 basis points to 31.7%, resulting in a 14.4% decline in net income.

The company's guidance gave no indication management sees near-term relief on the horizon. C.H. Robinson said it expects North American pricing to continue to reset downward in the quarters to come as capacity continues to exceed demand.

C.H. Robinson, due to its size, should be able to better manage through this environment than some smaller logistics companies, and the company, like XPO, is committed to automating as much of its business as possible to cut costs and make it easier for customers to use its systems. The difference is that while XPO managed to avoid a negative earnings surprise thanks in part to its initiatives, C.H. Robinson, in the most recent quarter, was pushed off the highway by the industry's cyclical nature.

One area in which C.H. Robinson handily outperforms XPO is its history of returning cash to shareholders via a dividend. The company has paid a dividend for more than 25 years and, following the post-earnings share sell-off, currently offers a dividend yield of more than 2.6%. C.H. Robinson might not have the growth-stock appeal of an XPO at its best, but the company has been the steadier (and more drama-free) of the two and is a solid part of an income-generating portfolio.

And the better buy is...

Trucking and transports have a long history of bankruptcies and failures -- just this month, Celadon Group became the largest truckload bankruptcy in history -- and this is the point in the cycle at which investors have to be careful. Fortunately, XPO and C.H. Robinson both have asset-light models and strong leadership and should have no problem driving through the current headwinds. But as the recent quarter has shown, the companies are not created equal. XPO appears to have more levers to pull to grow through a down cycle.

XPO's recent results indicate products like Direct and Connect are helping the company to take market share and accelerate growth in a climate in which others are stumbling. The cost savings that began a year ago as Amazon was exiting are beginning to take hold, which should help profitability, and over the next few quarters, the company faces some favorable year-over-year comparisons as it comes up on the one-year anniversary of its troubles. This stock is set up to outperform even if XPO can't find a good target to acquire. If XPO does find an M&A target and announce an acquisition that would likely further excite investors , given Jacobs' track record, and send the shares higher.

XPO shares, even after their gains in 2019, are still nearly 30% below the levels they traded at in September 2018. The stock still has a lot of room to run and the fuel in its portfolio to power the climb. XPO is the better buy.