Looks like Warren Buffett -- the Oracle of Omaha and CEO of Berkshire Hathaway -- was right about oil refiner Phillips 66 (NYSE:PSX). In late 2016, Berkshire affiliates backed up the proverbial truck, purchasing more than 1 million more shares in the refiner, for an average cost of $77.33. That gave Buffett a 15.5% stake in Phillips 66, making it one of Berkshire's 10 largest holdings, and easily its largest stake in an energy company.

Well, it goes to show that Buffett knows what he's doing, because Phillips 66 closed out 2017 at more than $101 per share, giving the oracle a 30.8% return -- so far -- on that last batch of shares. Here's how Phillips 66 did so well for Buffett in 2017, but why it might not do so well for investors who buy in now.

A man stands with mouth open and hands in the air as bills fly from an adjacent oil drum.

The stock market loved oil refiners in 2017, and Phillips 66 was no exception. But it may not be as good a buy now as it was then. Image source: Getty Images.

A rising tide

In some ways, Phillips 66 actually underperformed in 2017. Oil refiners had a great year overall, primarily for two reasons: summer demand and Hurricane Harvey.

With the economy doing well, the summer driving season was especially busy last year. That caused demand to spike, which -- coupled with low oil prices -- boosted the "crack spread," or the difference between the cost a refiner pays for an unrefined barrel of oil and the sale price of a barrel of refined petroleum. Thanks to high demand, the crack spread stayed high throughout the summer of 2017: between $12 and $18 per barrel. 

Then along came Harvey, which caused temporary shutdowns along the Gulf Coast, where most U.S. refinery capacity is located. The resulting supply disruptions temporarily pushed the crack spread to more than $35 per barrel. Drops in supply from Russia and OPEC and refineries operating at or near capacity also contributed to a fantastic year for refiners in general.

In fact, refiners did so well in 2017 that Phillips 66's 17.1% stock price jump was on the low end of refiners' gains, lagging peers like HollyFrontier (NYSE:HFC)Valero Energy (NYSE:VLO), and Marathon Petroleum (NYSE:MPC):

PSX Chart

PSX data by YCharts.

For the record, though, if you look at the performance of these four refiners over the last two years, Phillips 66's performance doesn't look nearly as bad, thanks to a better 2016 than its peers:

PSX Chart

PSX data by YCharts.

In the midstream

Although the bulk of Phillips 66's revenue comes from refining, the company also has some smaller reportable segments in chemicals, marketing gasoline, and midstream operations. It's this latter segment that was particularly noteworthy in 2017. Earnings for the first nine months of the year were up 35% over the first nine months of 2016. 

That was largely -- although not entirely -- due to the completion of the Dakota Access Pipeline/Bakken Pipeline, in which Phillips 66 owned a 25% stake. Oil began flowing through the Pipeline in the second quarter, so the third quarter represented the first full quarter of Pipeline revenue for Phillips 66, and it contributed to the transportation segment's $24 million sequential increase in revenue. In the fourth quarter, though, Phillips 66 transferred its ownership to its subsidiary Phillips 66 Partners in a drop-down transaction, which should benefit both companies. 

Phillips 66 has also been accelerating its share repurchases. During the third quarter, the company returned $817 million to shareholders through dividends and share repurchases. It also announced a new $3 billion share repurchase program, increasing the total amount of share repurchase authorizations to $12 billion since 2012. That could keep the good times rolling for company shareholders.

The fly in the soup

However, there are some signs that 2018 might not be as good for Phillips 66 as 2017 was. 

For one thing, even though the company's midstream and chemicals segments -- and their partners -- are wrapping up several planned expansions, the full impact of those completions won't be felt until later in the year. Even when they are completed, increases in earnings from those projects might not offset the potential reversion to the mean from the company's refining segment.

Like I mentioned earlier, a bunch of factors worked together in 2017 to make it a banner year for refiners across the board. It's unlikely that same set of conditions is going to persist through 2018. In fact, in the fourth quarter of 2017, oil prices rose above $60 per barrel, putting pressure on the crack spread. The odds of a hurricane scoring a direct hit on the nation's refining hub two years in a row are very low. Next summer's driving season might not be as busy. And who knows what OPEC or Russia will do as far as global oil production is concerned?

Investors should be aware of these changing market conditions before buying in.

Investor takeaway

Phillips 66's adjusted refining earnings for 2017 were up an eye-popping 109.4% year over year, and were the primary driver of the company's excellent performance last year. Those earnings are almost sure to ebb in 2018. The question is, can the company's other segments pick up the slack? I'm not so sure.

That said, Phillips 66 may have enough gas in the tank (sorry: couldn't resist) to continue its growth trajectory through 2018. The company's planned share buybacks and decent 2.7% dividend yield are worth considering as well. But at over $100 per share, it's nowhere near as sure a bet as Buffett made back in 2016.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.