What happened

Shares of refining, chemicals, and midstream giant Phillips 66 (PSX -1.76%) were rallying today, up as much as 5.1%, before settling into a 3.1% gain as of 2:18 p.m. ET.

Phillips reported third-quarter earnings, which, while declining quarter over quarter, still came in ahead of analyst expectations.

So what

Third-quarter non-GAAP (adjusted) earnings per share came in at $6.46 for Phillips, well ahead of the $5.03 anticipated by Wall Street analysts. CEO Mark Lashier said in a statement, "Third-quarter results reflect a continued favorable market environment, as well as strong operating performance and improved market capture."

Teasing through its segments, the midstream segment showed a strong sequential increase, largely due to Phillips increasing its economic interest in the DCP Midstream. Similarly, the marketing and specialties segment saw a sequential increase in operating earnings, thanks to wider margins in its international trading business.

Meanwhile, refining operating earnings declined as refining crack spreads narrowed, albeit off the extremely high margins seen in the second quarter, and they still remain healthy compared to last year. This is the largest segment for Phillips, making up two-thirds of operating income last quarter. The chemicals division also saw a sequential decrease, as polyethylene margins narrowed. Polyethylene is the most widely used plastic in the world, and it may be experiencing some soft demand as interest rates rise and the global economy slows down.

Now what

Phillips has had a nice year, rising along with the energy sector, as low refining capacity and soaring demand have helped results bounce back from the pandemic. While segment quarter-over-quarter profits were mixed, the second quarter of 2022 was extraordinarily strong. Meanwhile, year to date, Phillips' adjusted earnings are a whopping five times larger than earnings from the first nine months of 2021.

Phillips looks to be a solid pick in an inflationary environment in which demand for refined products remains strong and U.S. drilling activity will continue to keep oil and gas flowing through pipelines. That seems like a pretty solid bet, given recent strong economic data and resilient oil prices. While upstream explorers and producers may have more upside if oil and gas prices surge on other supply shocks, Phillips will likely be less volatile in a downside scenario, although it won't be immune. Meanwhile, investors will continue collecting the 3.7% dividend, along with healthy share repurchases.