Shares of Marathon Petroleum (MPC -0.56%) rallied 11.6% in January, according to data provided by S&P Global Market Intelligence. The main factor fueling the double-digit rise in the refining stock was its strong fourth-quarter results. The company also plans to trim its investment spending this year, which would, depending on market conditions, increase its free cash flow and ability to return money to shareholders.

A solid end to another solid year

Marathon Petroleum reported its fourth-quarter and full-year results near the end of January. The refining company delivered $1.5 billion, or $3.84 per share, of adjusted net income in the year's final quarter. While that was down from $3.3 billion, or $7.09 per share, from the year-ago period, it significantly exceeded the analysts' consensus estimate that it would earn $2.21 per share. The company also beat analysts' expectations for revenue ($36.8 billion versus $34.9 billion).

That capped a solid year for the refiner as it overcame pricing volatility to produce solid earnings and cash flow. Marathon Petroleum earned $9.7 billion while generating $14.1 billion in net cash provided by operating activities for the year. That strong cash flow supported its hefty cash returns, which totaled $12.8 billion in dividends and share buybacks last year.

Marathon can afford to return so much cash to investors because it has a cash-rich balance sheet (It ended the year with $10.2 billion of cash, equivalents, and short-term investments). Meanwhile, its business doesn't require much capital to sustain and expand its operations. Marathon expects its capital spending to be about $1.25 billion this year, down roughly 4% from 2023's level. That capital spending level doesn't include the $1.1 billion budget outlook of its affiliated master limited partnership (MLP) MPLX.

About 65% of Marathon's capital budget (roughly $825 million) will be on growth-related projects to enhance its margins and reduce costs. It's investing to improve the competitiveness of its Los Angeles refinery, including modernizing utility systems and increasing energy efficiency. It expects to complete those projects at the end of next year. Meanwhile, it's building a 90,000-barrel-per-day high-pressure distillate hydrotreater at its Galveston Bay refinery. That project will enable it to produce more higher-value refined products when it comes online by the end of 2027. In addition, the company's MLP is investing $1.1 billion into projects to grow its operations in the Marcellus and Permian basins.

Is Marathon Petroleum a buy after last month's pop?

As Marathon Petroleum demonstrated last year, it's a cash-flow machine. Its cash flow could be even stronger this year, given its reduced capital spending outlook and increased distributions from its high-yielding MLP (MPLX increased its payout by another 10% late last year). These factors could supply the refiner with more money to return to investors this year through dividends and repurchases. Those strong cash returns could give it the fuel to continue generating attractive total returns even after rallying last month.