What happened

Shares of Marathon Petroleum (MPC 0.19%) fell 12.7% in August, according to data provided by S&P Global Market Intelligence. Weighing on the refining company were its second-quarter results and the continued challenges in that sector.

So what

All things considered; Marathon Petroleum posted good second-quarter results. The refining giant reported $1.73 per share of adjusted earnings during the period, which beat the analysts' consensus by a healthy $0.40 per share. Fueling that stronger-than-expected result was its midstream and gas station businesses.

A refinery casts long shadows as the sun sets in the background.

Image source: Getty Images.

Midstream earnings surged 42% year over year to $878 million. The company benefited from recently completed expansion projects and the acquisition of an interest in Andeavor's former MLP, which came as part of its merger with that refiner. Meanwhile, earnings in Marathon Petroleum's gas station business rocketed more than 200% due mainly to the addition of Andeavor's legacy retail operations.

Those areas helped more than offset weakness in Marathon's refining business, where earnings declined by 11% year over year. The main issue was lower margins as a result of falling refined product prices.

The refining sector's challenges don't appear as if they'll let up in the near term. That's because the global economy seems to be slowing down due in part to the escalating trade war between the U.S. and China. The uncertainty resulting from that dispute is starting to weigh on demand for oil and refined products, causing them to begin piling up in storage. That trend continued in August, which suggests that Marathon's refining earnings could be under even more under pressure in the third quarter.

Now what

While the refining sector is battling some near-term headwinds, there's a catalyst on the horizon. Starting next year, shipping companies will need to use fuels with lower sulfur content, which will boost demand for these higher-margin products. That leads analysts to believe that Marathon's earnings will rebound in 2020, which is why most are very bullish on the company's stock.