Appraising a company on the basis of a single earnings report could be misleading. Marathon Petroleum's (NYSE:MPC) second-quarter results weren't impressive as high crude oil costs weighed down on the nation's fourth-largest refiner. However, if you intend to remain invested in this company for a long period, you could witness a solid return. The market's current attitude toward this stock shouldn't be a driving factor for your investment thesis.

The latest reported numbers
For the second quarter, Marathon Petroleum's net income fell 58% to $593 million, or $1.83 per diluted share, compared to the year-ago quarter. That's no doubt a major drop. Total operating income came in at $960 million, a sizable 27% drop from last year's second quarter.

Probing a little deeper, refining gross margin -- which is a rough measure of a refiner's profitability -- fell almost 45% to $6.11 per barrel. Though this doesn't come as a total surprise.

The apparent problem
Since March, the overall market has been developing cold feet toward refiners. As the price differential between the two most popular crude oil benchmarks -- the internationally traded Brent and the domestic West Texas Intermediate -- began to narrow, refining stocks started to slide.

Unlike last year, the outflow of crude oil to the Gulf Coast refineries from Cushing has been much more efficient in 2013. With fewer bottlenecks and higher takeaway capacity at the WTI storage hub, demand for the domestically sourced crude oil went up, which eventually wiped out the $20 per barrel discount against Brent crude. Here is a look at how Brent and WTI prices moved in the last 16 months:

Source: Data from Energy Information Administration

From the above graph, it's evident that refiners who had access to the cheaper WTI crude were at an obvious advantage. Along with Marathon Petroleum, some of the best performers last year were Western Refining (NYSE:WNR) and HollyFrontier (NYSE:HFC). For example, Western Refining's El Paso refinery directly sources WTI Midland from the Permian Basin, a huge advantage. Back then WTI Midland was cheaper than WTI Cushing. HollyFrontier, on the other hand, enjoyed phenomenal refining gross margins at over $25 per barrel.

This year however, as WTI started costing more, things started looking less rosy. With refiners having to pay more for crude feedstock, refining margins declined. Since mid-March all independent refiners have underperformed the broader equity markets, but to varying degrees. Here's a look at how the major refining stocks moved since mid-March as the Brent-WTI spread began to narrow:

^SPX Chart

^SPX data by YCharts

Evidently, refiners weren't having the best of times. However, Marathon Petroleum seems to have been punished more than the rest. The independent refiner lost almost 20% of its market value in the last five months. But digging deeper, things actually don't look so bad for the nation's third-largest independent refiner.

Why Marathon's predicament isn't that bad
Despite falling margins, total revenue rose 27% in the second quarter on a year-over-year basis. Marathon kept improving its fundamentals. Refined product sales volume increased a solid 35% from last year, to 2.13 million barrels per day.

So why did gross margins drop? Split the costs involved in the refining and marketing segment:

Source: Marathon Petroleum Q2 Earnings Call

Notice that the biggest drag on the R&M earnings did not come from price differentials among the various crude feedstocks. These price differentials -- Sweet/Sour differential, LLS/WTI differential, and LLS Prompt vs. Delivered -- together accounted for a $335 million drop in earnings compared to last year's second quarter. However, this isn't enough to overhaul the $640 million income from the LLS crack spread. Marathon still should have witnessed a handsome growth in earnings. Instead, the items, "direct costs", and "other gross margins" together accounted for a whopping $694 million drag on earnings.

So what are these costs?
It turns out that these items are mostly non-recurring. The $381 direct operating costs were primarily due to the acquisition of the Galveston Bay refinery earlier this year. The 451,000-barrels-per-day refinery off the Houston Ship Channel underwent major renovation to units and infrastructure. This charge was consistent with management's guidance.

The other $313 million drag was mainly due to a supply shortage at Marathon's Chicago refinery, and partly due to compliance with the Renewable Fuel Standard. While the supply situation was definitely unexpected, there isn't reason for me to worry about its recurrence. As far as compliance is concerned, it'll be beneficial in the long run. Additionally, this $65 million-plus charge is an industry-wide phenomenon.

The potential profits are huge
If we look at the positives, the biggest driver is the refiner's growing exports. At 190,000 barrels a day, Marathon has recorded the highest exports in its short history. The acquisition of the Galveston Bay has increased exports from 121,000 in the first quarter. On the earnings call, management has indicated that it is investing to further increase exports. As an investor, this is a solid earnings driver that you should be looking for.

Secondly, Marathon's crude slate is still very attractive. With the acquisition of the Galveston Bay refinery, the company has increased access to the cheaper sour crudes as well as crude oil from North Dakota which is pretty attractively priced. The lack of increased takeaway from the Bakken Shale play means depressed feedstock prices, which should work out to be advantageous to refiners like Marathon.

A Foolish takeaway
All in all, Marathon's business model looks solid. Investors should also not forget that management returned almost $1 billion to shareholders in the second quarter as dividends or stock buybacks. Marathon's image of being shareholder friendly should in itself be a driver to share prices. Which is why, appraising this refiner based on a single quarterly earnings report doesn't make a lot of sense.