The trucking recession isn't over, but Old Dominion Freight Line (ODFL -0.50%) provided a reminder last month that it is a best-in-class operator able to navigate through the slowdown.

Shares of Old Dominion climbed 19% in July, according to data provided by S&P Global Market Intelligence, after the company generated a better-than-expected second-quarter profit.

Cost controls drive an earnings beat

It has been a tough year for trucking companies. A post-pandemic surge in shipping faded in 2023 as large companies grew cautious about where the economy was heading. Even with the bankruptcy of Yellow, previously one of the largest operators in the less-than-truckload (LTL) segment of the business, supply has outstripped demand, and pricing power has been nonexistent.

These periods happen in a cyclical industry like trucking, and the best operators are the ones that can manage costs and ride out the storm.

In July, Old Dominion, long considered to be among the best operators, delivered quarterly results that helped put investors at ease. The company earned $1.48 per share on sales of $1.5 billion, a beat of $0.03 per share on revenue that came in as expected.

Revenue was up 6% year over year, and net income grew by 10%. The company's operating ratio, a measure of how much it costs to generate each dollar of revenue, fell by 40 basis points to 71.9% (lower numbers are better).

"Old Dominion produced another quarter of profitable growth despite continued softness in the domestic economy," CEO Marty Freeman said. "This was our third consecutive quarter with growth in both revenue and earnings per diluted share, and it was the first time in over a year where our earnings increased by double digits."

Is Old Dominion stock a buy?

It has been a mixed earnings season for truckers, with other well-regarded operators not having nearly the success of Old Dominion. And the market free fall over the first two days of August is a reminder that questions about the economy are far from settled. Until corporate America has a better idea where the economy is heading from here, demand is unlikely to fully rebound.

That said, Old Dominion has demonstrated again and again its ability to weather difficult environments, and long-term shareholders who are willing to be patient through down cycles have been well rewarded. Over the last decade, a long enough period to account for multiple business cycles, Old Dominion shares have outperformed the S&P 500 by more than 600 percentage points.

For those with a long-term mindset, this is a good time to have Old Dominion on their radar.