Refining stocks have surged this year. Little-known oil refiners PBF Energy (PBF -1.88%) and Delek US Holdings (DK -2.15%) have seen their share prices more than double in value. Meanwhile, larger industry leaders Valero (VLO -1.65%)Marathon Petroleum (MPC -0.84%), and Phillips 66 are up between 30% and 60% on the year. These huge surges are coming amid a brutal bear market for other stocks. 

Fueling this year's surge in refining stocks is their soaring profits. The sector is cashing in on the widening spread (known as the crack spread) between where they buy oil and the price they can sell refined petroleum products like gasoline, jet fuel, and diesel. Those product prices are also surging this year due to resurgent demand. That's causing consumers of those products to pay even more, begging the question of whether refiners are part of the problem. Here's a look at the current state of the refining sector.

Drilling down into the problem

Tom Nimbley, the CEO of independent refiner PBF Energy, commented on the current refining market environment in the company's first-quarter earnings press release. He stated: "Global supply and demand balances were tight coming into the year. Low product inventories have not recovered due to increasing demand and significant maintenance activity across the global refining system."

In a sense, we've hit a perfect storm that's driving up refined product prices. During the early days of the pandemic, demand for refined products fell off a cliff. That caused inventory levels in storage terminals to swell, nearly driving prices to collapse. As a result, refiners cut back on their production capacity to give the economy time to burn off the excess supply. That happened a little faster than expected. As a result, the sector entered 2022 with less inventory when demand surged, which came at the same time as a supply shock following Russia's invasion of Ukraine.

Meanwhile, the industry couldn't flip a switch and bring all its capacity back online because of planned annual maintenance activities in the first quarter to get ready for the summer driving season. However, many companies worked hard to complete that work as fast as possible. For example, PBF's CEO noted that his company: "Completed nearly one-third of our annual planned turnaround activities, advanced some planned activities due to a window provided by unplanned downtime, and restarted limited secondary processing units on the East Coast. We are focused on putting our entire refining system in a position to run safely and reliably in anticipation of increasing seasonal demand."

Larger rival Marathon Petroleum also worked hard to produce more refined products even while working on maintenance projects. Marathon processed 2.8 million barrels of oil per day in the quarter, up from 2.6 million in the year-ago period. That increased its refinery utilization to 91%, up from 83%. That's about as much as the company could produce because of previously planned maintenance activities in the quarter. With those projects now complete, Marathon hopes to process even more crude in the second quarter, expecting to increase its utilization to 95%. 

It's finally a good time to be a refiner

Refiners are price takers, not price makers. They take whatever the market will give them for the refined products they sell; they don't set those prices. That's great when the crack spread is wide but is challenging when it's narrower.

Most refiners are cashing on the surging crack spread these days after suffering from a much lower one last year. For example, Marathon Petroleum produced $1.4 billion in adjusted earnings before taxes, interest, depreciation, and amortization (EBITDA) out of its refining and marketing segment during the first quarter. That's a remarkable improvement from the mere $23 million of adjusted EBITDA the company recorded out of the sector in last year's first quarter. A big driver was the widening spread. Marathon's refining margin ballooned to $15.31 per barrel in the quarter, up from $10.16 per barrel in the year-ago period. 

Smaller rival Delek US reported that crack spreads in the regions it operates skyrocketed 84.2% during the first quarter. That enabled the company to generate $152.9 million in adjusted earnings from the segment, a massive improvement from a $3.9 million loss in the year-ago period. 

Valero also posted a much larger refining profit in the quarter. After reporting a more than $500 million loss in the year-ago period, Valero generated a nearly $1.5 billion profit in the first quarter. 

Taking what the market is giving them

There's no doubt most refining companies are cashing in on improving demand for refined products these days. However, they're also not to blame for the problem. Demand recovered faster than expected and came at a time when inventories were low and the industry was busy working on maintenance projects. While most of those projects are complete, it will take the industry time to catch up with demand and replenish inventory levels. In the meantime, they'll earn a tidy profit, which will help make up for the losses many experienced over the past couple of years. That could give their stocks the fuel to continue heading higher, which would help their investors offset at least some of the increase they're paying at the pump.