Chevron (CVX -0.73%) continued to capitalize on strong conditions in the oil and gas market. The energy giant's earnings soared well past analysts' expectations. That gave the oil company's stock the fuel to rally toward a record high. 

The rise in Chevron's stock price is further enriching Warren Buffett, whose Berkshire Hathaway counts the oil stock as its third-largest holding. Here's a closer look at the quarter and whether now is still a good time to buy one of Buffett's favorite stocks. 

Another profit gusher

Chevron reported $11.2 billion, or $5.78 per share, of earnings for the third quarter. That was nearly double the $6.1 billion, or $3.19 per share, it posted in the year-ago period. While profits were slightly below the all-time high Chevron posted in the second quarter as oil prices cooled off, its results beat analysts' expectations by a wide margin. 

Chevron's cash flow from operations hit a record $15.3 billion in the quarter. Meanwhile, it produced $12.3 billion in free cash flow. 

The energy giant benefited from higher prices in the quarter. Chevron sold its oil for an average of $76 per barrel in the U.S. and $89 per barrel internationally. That's up from $58 per barrel and $68 per barrel, respectively, in the year-ago period. Meanwhile, the company sold its natural gas for an average of $7.05 per cubic foot in the U.S. and $10.36 per cubic foot internationally, up from $3.25 and $6.28 per cubic foot, respectively.

Chevron also delivered strong results in its international downstream business, where earnings increased by over $1 billion. The company's international refineries processed 11% more crude oil in the quarter, fueled by higher demand. Chevron also benefited from higher refining margins in the period.

Returning and reinvesting the windfall

Chevron's gushing profits and cash flow gave it more money to allocate on behalf of shareholders. The oil giant returned $6.5 billion of cash to shareholders. It paid $2.7 billion in dividends (6% higher than the year-ago period) and repurchased $3.75 billion of its stock (more than 1% of its outstanding shares). In addition, Chevron paid down debt for the sixth straight quarter. 

The energy giant also continues to invest in traditional and new energy sources. It has increased its capital investments by 50% over the past year to meet the world's growing demand for energy. These investments are earning high returns, with its return on capital employed reaching 25% in the third quarter. Chevron made several notable recent investments, including approving projects to increase its oil refining capacity in the U.S. and progressing its carbon capture and storage initiatives. These and other projects position Chevron to deliver lower carbon energy to meet global demand.

Is it still time to buy?

With Chevron's strong third-quarter performance pushing its stock to an all-time high, investors are likely wondering if they missed the boat. On the one hand, there might be less upside since shares are already up more than 50% this year.

However, surging oil and gas prices have showcased the need for continued investment in traditional energy sources. After years of underinvestment due to lower prices and climate change concerns, supplies are struggling to keep up with demand. Because of that, prices could remain elevated for quite some time. That should enable Chevron to continue producing lots of cash that it can reinvest at high returns while returning boatloads to shareholders. 

Because of that, the stock could continue rising. Buffett holds that thesis. Berkshire Hathaway has continued to gobble up shares of the energy giant this year despite its rising stock price. While Buffett's purchases aren't a reason to buy, having his stamp of approval certainly makes Chevron stand out as a top choice in the sector for those seeking exposure to the upside of oil prices.