Chevron (CVX 0.75%) reported earnings of $11.6 billion in the second quarter -- more than four times what it delivered in the prior-year period. That gusher of profit set a new quarterly record and blew past analysts' estimates as the company cashed in on higher oil and gas prices. 

Yet that excellent quarter could have been even better. In one of the best refining markets in years, volumes in Chevron's refining business were down 8%. Should investors be concerned about this weak spot in the oil giant's operations?

A bad time for downtime

As an integrated oil company, Chevron operates upstream oil and gas production assets and downstream refining and chemicals operations. Its businesses in both segments capitalized on the strong market conditions in the second quarter. Upstream earnings soared nearly 170% to around $8.6 billion, while downstream profits rocketed by more than 300% to $3.5 billion. 

Chevron's U.S. downstream business contributed $2.4 billion of that profit, mainly due to higher margins and refined product sales. However, it reported that crude oil inputs at its U.S. refineries were down by 8% in the period to 881,000 barrels per day, primarily due to planned turnarounds during which refining facilities go offline for preventative maintenance. 

While Chevron had planned for those maintenance breaks, they couldn't have come at a worse time. As a result of that downtime, the company wasn't able to fully capture the upside of the hot market for refined petroleum products -- something many of its rivals were able to do.

For example, leading independent refiner Valero's (VLO -2.86%) throughput volumes averaged 3 million barrels per day in the second quarter, up 127,000 barrels per day from the prior-year period. Valero's ability to maximize refinery run rates -- which reached 94% in the quarter -- enabled it to effectively capitalize on higher refining margins and robust demand for refined petroleum products. Its refining earnings rocketed to $6.2 billion, up from $349 million in the year-ago period. 

Meanwhile, Chevron's integrated oil peer ExxonMobil (XOM -0.09%) also enjoyed strong refinery utilization in Q2. As a result, its global refining business generated $5.2 billion of earnings, a huge turnaround from its $196 million loss in the year-ago period. 

Back to full strength in no time

While Chevron wasn't able to take full advantage of Q2's strong refining market conditions, this is just a temporary headwind for the company. During planned turnaround maintenance, refiners often uncover larger problems that require more prolonged refinery shutdowns to remedy. However, that wasn't the case here. Chevron didn't report any unexpected issues. Because of that, its refinery output should improve as it brings those facilities back online. That should enable Chevron to better capitalize on the continued strong conditions in the refining market.

Valero's chief commercial officer, Gary Simmons, noted on that company's recent second-quarter conference call that despite worries of a recession, it was not seeing "any indication of demand destruction." Instead, he said, Valero "actually set sales records in June." And while it saw a slight lull in demand in early July, sales "are now back to kind of that June level, with gasoline at pre-pandemic levels and diesel continuing to trend above pre-pandemic levels." That certainly bodes well for Chevron's refining business in the third quarter.

Meanwhile, the rest of Chevron's integrated operations are firing on all cylinders. Output from its U.S. upstream business increased in Q2 due to higher production in the oil-rich Permian Basin. On top of that, its international downstream business delivered higher refinery output and product sales. Those segments helped contribute to its record profits and strong free cash flow generation, which topped $10 billion in the quarter. That enabled Chevron to strengthen its balance sheet and get its debt ratio under 15%. It also gave the company the confidence to boost its annual share repurchase guidance to a range of $5 billion to $15 billion, up from $5 billion to $10 billion.

The benefits of being integrated

Chevron's integrated business model proved its worth in the second quarter. While its refining business couldn't fully capitalize on the strong market conditions, its other business segments' excellent results more than offset its missed opportunity.

The company should be at full strength in the third quarter, and could produce an even bigger profit gusher if recent market conditions persist. That catalyst, along with its increased stock buybacks, could drive its shares even higher, so Chevron stock still looks like a buy for those seeking exposure to the upside of the oil and refining markets.