Shares of Occidental Petroleum (OXY -0.15%) slumped 5.2% in 2023, according to data provided by S&P Global Market Intelligence. That wouldn't have been such a bad decline if the S&P 500 hadn't been up 24.3% for the year.

The main factor weighing on the oil stock was crude prices. Last year would have likely been much better for Occidental's investors if it hadn't been for lower oil prices.

Oil prices blurred a strong year for the oil company

Crude prices took a breather last year, slumping more than 10%. That marked oil's first decline since 2020.

Lower oil prices weighed on Occidental's cash flow. The company's operational cash flow totaled $9 billion through the third quarter, about $3.8 billion less than in the year-ago period. Meanwhile, Occidental's capital spending was more during the first nine months of last year ($4.7 billion) than all of 2022 ($4.5 billion). As a result, it only generated $4.4 billion in free cash flow through the third quarter, less than half its tally in the year-ago period.

However, despite its slumping free cash flow, Occidental was still able to return cash to shareholders and make two notable acquisitions. It repurchased $1.8 billion of stock through the third quarter (60% of its 2023 target) and increased its dividend by 38.5%. That level of cash returns triggered the redemption of $1.5 billion of preferred equity owned by Warren Buffett's Berkshire Hathaway.

Speaking of Berkshire, it took advantage of Occidental's oil-fueled sell-off to buy more shares last year. The holding company has steadily increased its stake in the oil producer, growing it to 27.7% by the end of last year. It's Berkshire's sixth-largest holding at over $14.1 billion, or 3.9% of its portfolio.

Meanwhile, Occidental took advantage of last year's more challenging market conditions to make a couple of acquisitions. It agreed to buy CrownRock for $12 billion in December to boost its position in the Permian Basin. Occidental estimates that the deal will increase its free cash flow by around $1 billion in the coming year, assuming oil prices average around $70 a barrel (right around the recent price). That helps support its plan of increasing its dividend by another 22%.

Occidental Petroleum also bolstered its carbon capture platform. It acquired partner Carbon Engineering for $1.1 billion. The companies have been working on deploying direct air capture (DAC) technology since 2019. Meanwhile, Occidental brought in a new partner, signing a joint venture with BlackRock to invest $550 million into its STRATOS development, which will be the world's largest DAC facility when it comes online in 2025.

Is Occidental Petroleum a buy after last year's slump?

While oil prices weighed on Occidental's cash flow last year, it still had a strong year. It generated lots of cash, giving it money to return to investors and invest in its future. Its free cash flow should grow in 2024, fueled by its CrownRock deal, with more growth potential ahead in 2025 when STRATOS comes online.

Those factors make Occidental a compelling oil stock to buy for the long haul, which certainly seems to be Berkshire's view, given that Buffett's company continues to scoop up shares.