American oil and gas giant Phillips 66 (NYSE:PSX) announced second-quarter earnings on July 31, reporting another quarter of solid profits driven by its refining business, even as demand growth for oil remains relatively weak around the world. And while the still-weak market for oil is causing problems all across the oil and gas industry, the company continues to perform admirably. 

As a matter of fact, there's a strong case that Phillips 66 is worth buying right now. Let's take a close look at three reasons why: Refining strength, solid growth in other business segments, and the people in charge. 

1. Refining strength driving the results
The collapse in oil prices over the past year-plus hasn't really affected refinery operators in the U.S. that can process American, Canadian, and South American crudes. Over the past several decades, American dependence on imported oil led to many refiners configuring their systems to process that imported oil, typically traded at the Brent global benchmark price. This was especially true when domestic production dropped, starting in the 1970s:

US Crude Oil Production Chart

US Crude Oil Production data by YCharts.

The higher production of oil that traded at Brent prices -- largely from the Middle East -- was consistently less expensive than American oil, trading at the West Texas Intermediate price:

Brent Crude Oil Spot Price Chart

Brent Crude Oil Spot Price data by YCharts.

As you can see in the table above, WTI (orange line) historically cost more than Brent (blue) until around 2011, when the shale boom led to huge growth in domestic production. Refiners like Phillips 66, with some of the world's most advanced refineries, have been able to take advantage of this price spread, driving much of that lower cost right to the bottom line. 

Why? Oil sold at the Brent benchmark still makes up the majority of global supply, and this is the benchmark that most heavily impacts the price of gas, diesel, and other distillates. In short, the oversupply of American oil has created a -- so far -- pretty sustainable cost advantage for Phillips 66 and a few other American refiners. And since the price of its products is heavily related to the price it pays for its main input -- oil -- the company can sustain its margins relatively easily. This is evident just by reviewing the past several quarters' earnings results. 

2. Beyond refining 
As much as refining is the company's strength and likely to remain so for years to come, it's not exactly a growth business. Even as the world gets more populous and wealthy (which typically means more energy-hungry), fuel-efficient and alternative energy technologies will impact global demand for many refined products. So, while this mature business will continue to produce massive cash, the company's best investments in growth are happening in the petrochemicals and midstream segments of its business. 

In 2015, the company will invest $3.4 billion in capital growth projects, with around two-thirds of that going toward midstream projects. 

Besides its joint venture with Encana, DCP Midstream, Phillips 66's midstream business is largely based on fees, not commodity prices:

G
Source: Phillips 66 presentation.

Phillips 66 is investing to grow its fee-based business, including expanding its terminal in Beaumont as well as building new pipelines to more cheaply move crude from South Dakota's Bakken into Texas. The company is also investing to help it get better returns on NGLs, which are responsible for the majority of its exposure to commodity prices. Phillips 66 is building multiple new fractionators, which break NGLs down into their separate components, like propane, butane, and ethane, which it can then sell in end markets. This will partly help supply the LPG -- which is propane -- export terminal the company is building.

The reality is, the huge growth in NGL production hasn't had any major corresponding growth in domestic demand. Yes -- there has been and will be further expansion in demand from the chemical industry to make things like fertilizer, plastics, rubber, and synthetic fabrics like polyester, but there's a major imbalance today. Increasing export capacity will help increase demand, as well as give the company access to international markets that command higher prices for propane. 

All in, Phillips 66 expects its investments in the midstream segment to more than triple EBITDA over the next three years:

G

The slide above excludes DCP Midstream -- both the losses today as well as any future losses or gains -- but it's a solid representation of the company's opportunity to grow its midstream. 

The chemicals business, CPChem, is a 50/50 joint venture with Chevron. CPChem is in the midst of $7 billion in expansions. This growth in capacity is expected to add as much as $1.6 billion in incremental EBITDA by 2018, as these projects come online in the next 18-24 months. Further, the joint venture is able to fund its capital projects directly, not requiring cash infusions from the joint owners. 

3. Strong leadership is central to making it work 
It may be harder to quantify great management, but it shouldn't be discounted. When you have a company like Phillips 66 that produces so much cash and has limited opportunities to grow, it's easier for management to make poor decisions with that cash, such as acquisitions to grow revenue that don't really add much per-share value. CEO Greg Garland and his team have done an admirable job allocating capital since the company was spun out of ConocoPhillips a few years back. 

Just as importantly, they have also done an excellent job of returning a portion of the excess back to shareholders. 

PSX Shares Outstanding Chart

PSX Shares Outstanding data by YCharts.

Even with the huge dividend growth and share buybacks since going public, the company still generates significant retained cash flows to invest in strategic growth. It takes a disciplined management team to accomplish this successfully. 

Time to buy? 
As hard as falling oil prices and demand have been on much of the industry, Phillips 66's core businesses are either unaffected or even benefit, making this a great way for investors to gain exposure while also reducing the risk of oil and gas prices staying down for a prolonged period of time. 

Considering the strength of the refining business, and a management team that has proved excellent at using cash to fund strategic growth while returning excess back to investors, there's a lot to like about this business. Lastly, the share price is basically flat since the beginning of 2014 and, by metrics like price-to-earnings and EV to EBITDA, is actually cheaper today.

Now looks like a great time to invest in a great company. 

Jason Hall owns shares of Phillips 66. The Motley Fool has no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.