XPO Logistics (XPO 1.60%) and J.B. Hunt Transportation (JBHT 2.32%) operate in the same industry, but their stock performance and profiles couldn't look more different. XPO until recently was the rare Wall Street darling among transportation companies that has delivered both tech-like returns for investors and, lately, stomach-churning volatility. J.B. Hunt, meanwhile, has provided more typical slow-but-steady appreciation fueled by the broader economic cycle.

XPO and J.B. Hunt have likely attracted different types of investors over the years, but at their core they are both logistics and transportation operators that are impacted by the same global trade and economic forces. Both have been under pressure in recent quarters, and with concern growing that the economy is beginning to show signs of sputtering, both need to be under investors' watchful eye.

Here's a look at the two companies to try to determine which, if either, is a better buy today.

A fallen star

XPO has gone from overachiever to underperformer in just the past six months. CEO and rollup specialist Bradley Jacobs has used dealmaking to transform the company from a trucking brockerage with $177 million in sales into a $17 billion shipping behemoth in less than a decade, producing a more than 3,000% return on the shares during a 10-year period ending in mid-2018.

An XPO Logistics truck driving in the city.

Image source: XPO Logistics.

Alas, the stock has lost about half of its value in the last six months, as it ran into a series of potholes starting with criticism from short-seller Spruce Point Capital beginning in October and followed by a quarterly miss in February after XPO said its largest customer was taking its business in-house.

In early March, XPO said its chief operating officer Kenneth R. Wagers, on the job for less than a year, was terminated without cause. Wagers was set to lead XPO's continued rollup and acquisition strategy, and his departure was seen as an indication that XPO's deal machine, which was key to those outsized returns, was taking a long-term hiatus.

The large customer XPO lost is believed to be Amazon.com, but Amazon is going elsewhere in part because XPO has built its XPO Direct business into a transport back office providing non-Amazon retailers and e-commerce companies with integrated logistics, transportation, and delivery service.

XPO is one of the world's largest freight brokerage businesses, and even after the loss of that major customer and weakness throughout Europe the company is still expected to generate revenue and earnings growth and throw off about $600 million in free cash flow in 2019. It's also more affordable now than it has been in nearly a decade, trading at 17.6 times earnings, down from a multiple of more than 30 last August.

Check out the latest earnings call transcripts for XPO Logistics and J.B. Hunt Transportation.

A trucker stuck in the slow lane

J.B. Hunt is a trucking and transport company that derives about two-thirds of its revenue from intermodal, cargo containers that travel to their destination via multiple forms of transit like ship to truck or truck to train. The company provides a range of truckload and less-than-truckload services, and earlier this year completed a $100 million acquisition of Cory 1st Choice Home Delivery to expand its presence in the $5 billion market for delivery of furniture and other bulky items to homes and offices.

The company has been a sluggish performer over the past three years, with shares up 17% compared to a 38% gain for the S&P 500. J.B. Hunt's business tends to ebb and flow based on the strength of the U.S. economy, and the intermodal business in particular is closely linked to trade with China and vulnerable to potential tariffs, so it is perhaps no surprise that the shares are down 16% over the past six months given the heightening of trade war rhetoric.

Intermodal containers stacked at port.

Intermodal containers stacked at port. Image source: XPO Logistics.

J.B. Hunt has also been in arbitration with Berkshire Hathaway-owned BNSF Railway, one of its major intermodal partners, over how revenue from that partnership should be split. The dispute is still ongoing, but the initial results would imply that the railroad will be able to take more of the value out of that partnership in the years to come. The partnership is critical to both companies' operations, and therefore seems unlikely to dissolve, but a poor resolution could eat into future J.B. Hunt profits.

J.B. Hunt has its own potential insourcing issues to deal with as well. Walmart has begun moving some of its intermodal operations in-house using company-owned containers and transporting them from the port with its own trucks. That's business that traditionally has gone to J.B. Hunt and other intermodal operators like Hub Group. For now, the operation covers just a small sliver of Walmart's overall transport needs, but if viewed as a trial, there's a risk that Walmart will, over time, lessen its dependence on third-party shippers, a long-term threat to J.B. Hunt.

The better buy is...

As said before, XPO and J.B. Hunt offer two very different profiles for potential investors. But one thing the two stocks share is that it is a tricky moment to buy into either company.

I'd be hesitant to buy XPO right now because of the uncertainty surrounding its growth plans and how long the dealmaking break will last. But I'm also not comfortable buying into more traditional truckers like J.B. Hunt amid questions about the global economy, and in a year when many analysts believe transport companies will be challenged to push through rate hikes. J.B. Hunt also trades at a premium to XPO today -- it's priced at 22 times trailing earnings and 1.27 times sales.

XPO PE Ratio (TTM) Chart

XPO vs. JBHT PE and PS Ratio (TTM) data by YCharts.

Absent a return to dealmaking, I'm skeptical XPO will ever get back to the multiple it enjoyed earlier in the decade. But even without further expansion, the collection of assets assembled under the XPO roof is substantial, and the company is well-positioned to be one of the major beneficiaries of the continuing shift toward e-commerce and delivery even if Amazon does move all its business in-house.

J.B. Hunt is a solid operator, and there is real risk to buying into XPO right now given the amount of uncertainty that surrounds the company. But despite the drama, I believe XPO will prove to be the better stock to own over the next five to 10 years.