Canadian National Railways (NYSE:CNI) reported earnings for its second quarter on July 20, and in short, it was a solid quarter, especially in the face of some new challenges the company must deal with. Maybe the best way to describe it is like this: The company is making the best out of a less than ideal environment. The highlights:

  • Revenue of Canadian $3.125 billion -- flat from a year ago. 
  • Earnings per share of $1.10, up 7% from a year ago. Adjusted earnings up 12%. 
  • Operating costs down; weakening shipment demand expected for the remainder of 2015.

The company reduced operating expenses in the quarter but also announced that demand would be weaker in 2015 than had been expected. Let's take a closer look at the four biggest things I learned when the company reported this week. 

Energy and materials business weakening; automotive, intermodal strong
Coal shipments (RTMs down 32%) continue to weaken, as do agriculture-related shipments such as grain and fertilizer (RTMs down 16%), but this wasn't particularly surprising. The company also reported weaker shipments of steel goods and iron ore. 

What is new is the impact falling oil prices are having on carload and RTM growth. When the company last reported in April, it was projecting for 40,000 more carloads of oil and oil-related shipments in 2015. With crude oil prices showing little likelihood of recovering, CN management is making a prudent call, revising its assumptions, and planning for no growth in this segment for the remainder of the year. 

The company also stated that it is revising down its assumptions on North American industrial production for the full year and now expects total carloads for 2015 to be similar to last year, versus the 3% increase management had been expecting. 

Yet even as the reality of what the demand picture will be for the full year has clarified, the company has already taken steps to get its costs in line and make sure it's maximizing its pricing power. The earnings release mentioned several times that the company was increasing prices faster than inflation, which should further protect the bottom-line growth, as long as the company doesn't act too aggressively to raise prices and create long-term risks to its customer relationships. 

CN also reported strong automotive and overseas intermodal shipments shipments growth of 8% and 6% respectively. (Intermodal refers to containers that can move from ship to truck to train.)

Turning up the efficiency to 11, even as business weakens
CN lowered its operating ratio to 56.4%, from 59.6% a year ago, and 65.7% in the fourth quarter. A lower ratio here is better, as it is essentially the percentage of revenue the company must spend on operating expenses. This is especially impressive this quarter, considering the company's total sales declined a small amount when adjusted for currency exchange.

The key drivers behind the improved efficiency? Falling fuel costs, and higher rates. Total carloads fell 3%, but the company charged on average 3% more, collecting the same amount of money for less work.  

Fuel savings are driving operating cost savings, but that's a double-edged sword
It's important to mention that CN's biggest cost-savings category was fuel. This makes sense, as fuel is the company's biggest single expense after labor and benefits, but it's also something that's largely outside the company's control and set by the market. It's also partly offset through fuel surcharge agreements with customers. So if we look at operating expenses excluding fuel, we see that total costs increased by $62 million last quarter.

What does this tell us? The company is saving a lot of money, but at the cost of its biggest planned source of growth for the year. I bet management would happily pay more for diesel if it were getting those 40,000 lost carloads of oil and frac sand the oil collapse caused to dry up. 

Capital spending will lay the track for growth
CN still plans to spend $2.7 billion on capital projects in 2015, with $1.3 billion expected to go toward future growth while the balance goes toward network improvement.

The company recently announced that it will expand its service in two major ports on the Gulf of Mexico, which should provide a significant opportunity once the Panama Canal's current major expansion project is complete. This expansion is expected to double the canal's capacity and greatly increase the size of cargo ship it can accommodate, and this is expected to lead to an increased amount of shipping from Asia to the U.S. Gulf Coast. Canadian National is positioning itself to play a big role moving those goods on dry land.  

Keeping it all on track 
Earlier this year, the company was expecting moderate growth in carloads, but weak oil and gas prices have derailed that market more than strong automotive and intermodal growth can make up for. Nonetheless, cheap oil is helping the company put more of its revenue to the bottom line, even though it also cuts the amount the railway gets in fuel surcharges to help offset fuel expenses. 

Add it all together, and it's another reminder that rail carriers such as Canadian National remain highly attached to the overall economic environment, and when there is weakness in sectors that are heavily tied to rail shipment, it will affect the company's business. In other words, the best railroads are the ones that stay within what they can control, and focus on cost containment, safety, and quick expansion when there's opportunity. 

With that in mind, try to keep your focus on the big picture: How is the company investing for the future, and how well are its leaders managing the company's capital? If they're building a solid railroad with a serious focus on the long term, eventually the market will bounce back, and the best-run businesses will shine. 

Jason Hall has no position in any stocks mentioned. The Motley Fool recommends Canadian National Railway. The Motley Fool owns shares of Canadian National Railway. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.