What happened

Shares of Old Dominion Freight Line (ODFL -1.42%) climbed 11.9% in July, according to data provided by S&P Global Market Intelligence, as investors reacted positively to another strong quarter for the trucker. Given the signs of strain on the trucking market, Old Dominion's current run of results is even more remarkable.

So what

Old Dominion shares got a big boost mid-month when it reported second-quarter earnings per share of $2.16, up 8.5% year over year and $0.04 per share ahead of consensus. Revenue was slightly below expectations but climbed 2.6% over the prior year.

An Old Dominion truck on the highway.

Image source: Old Dominion Freight Line.

The story of the quarter, and the reason for the investor enthusiasm, is Old Dominion's continued pricing and cost discipline in the face of potential trade wars and a global economic slowdown. Old Dominion did well passing increased costs on to customers, generating less-than-truckload revenue up 9.5% from last year despite declines in total tonnage and shipments. And the company's operating ratio -- a measure of operating expenses as a percentage of revenue -- was 77.9%, a company record.

Old Dominion's cash flow from operations totaled $255.7 million for the quarter and $461.9 million for the first half of 2019, which should provide plenty of flexibility for returns to shareholders. The company in April trimmed its full-year capital expenditure budget by $10 million to $480 million and held steady to that number in the latest release.

The company so far in 2019 has repurchased $164.7 million worth of shares and paid $27.4 million in dividends.

Now what

Old Dominion shares are up 34% year to date, outperforming the S&P 500 by nearly 17 percentage points in what has been a difficult climate for transport stocks. There are still a lot of macro challenges on the road ahead, including weakening demand, pressure on contract truckload rates, and ample capacity that could combine to pressure margins in the quarters to come.

But CEO Greg C. Gantt on a post-earnings call with investors sounded upbeat that Old Dominion can prosper even in difficult times.

Managing through both the ups and downs of the business cycle is not easy, though the consistency in our service and financial result has been remarkable. We have never wavered from our commitment to service, despite the associated cost due to the support it provides for our ability to maintain price discipline. The importance of yield to our financial results couldn't be more apparent than it was in the second quarter.

Even a well-run company can not generate sustained growth in a flat to declining market indefinitely, and Old Dominion shares seem unlikely to continue to climb at the same blistering pace in the quarters to come. But long-term holders should take comfort knowing that Old Dominion is staying strong in a challenging market.