What happened

Crude oil prices are in rally mode today. The June contract for WTI, the primary U.S. oil benchmark, surged more than 30% to around $16 a barrel. That rebound, along with a few other factors, fueled oil stocks today. 

Shares of several oil-related companies were up more than 10% at 11:15 a.m. EDT on Wednesday. Leading the way were SM Energy (SM 1.97%)Matador Resources (MTDR 0.71%)WPX Energy (WPX)NGL Energy Partners (NGL 1.56%), and PBF Energy (PBF 1.49%)

The sun setting behind an oil pump.

Image source: Getty Images.

So what

Oil prices spiked due, in part, to the latest inventory data from the U.S. Energy Information Administration. While oil storage levels rose by 9 million barrels over the past week -- the 14th consecutive weekly increase -- that was less than the 9.8 million barrel build analysts anticipated. That lower-than-anticipated inventory increase is good news for a country that's running out of room to store oil.

The combination of higher oil prices and better inventory data drove up shares of oil producers like SM Energy, WPX Energy, and Matador Resources since they'll make more money if oil keeps rising. However, the deep slump in oil prices this year is having an impact on their finances and operations.

That was certainly the case with SM Energy, which reported its first-quarter results this morning. The company posted an adjusted net loss of $0.11 per share and had to write down $990 million of the value of its oil and gas properties in south Texas due to low oil and gas prices.

Further, the company reduced its capital spending budget by 20% this year to better align with lower oil prices. As a result, it will drop one drilling rig in July. The company also said it would shut down some of its uneconomic wells. These factors forced the company to withdraw its production guidance for the year.

The weakness in the oil market will likely have similar impacts on Matador Resources and WPX Energy. Investors won't have to wait long for an update from the former since it will release its first-quarter results after the market closes today. The latter, meanwhile, will report on May 7.

Analysts at Goldman Sachs, however, are quite bullish on what's ahead for WPX Energy. They upgraded the stock yesterday from neutral to buy and raised their price target to $6.75 per share, based on the view that it could outperform if oil prices recover due to its low supply costs. Meanwhile, the bank likes the company's hedge position, which will help protect it against lower prices.

NGL Energy Partners, meanwhile, is rallying again today. Units of the MLP soared yesterday after it updated investors on its outlook and reduced its distribution. That's carrying through today, especially since higher oil prices might give drillers the confidence to restart drilling activities later this year. That would boost volumes flowing through its system, increasing its cash flow.

Refiner PBF Energy, meanwhile, is also rallying sharply today, even though it would typically benefit more from lower oil prices than higher ones. Instead, investors are optimistic that more states will start reopening their economies, which means more cars will be on the road. That should lift fuel demand for refined products, which would boost refining margins and PBF Energy's bottom line.

Now what

Oil stocks are surging on the view that market conditions are starting to improve. While it's true that many states are preparing to reopen their economies, which should boost oil demand, the industry has a massive glut of it in storage that will take months to burn off.

That will likely keep oil prices low for quite a while, which could cause a wave of bankruptcies to wash over the sector. Because of that, investors should tread carefully around oil stocks, focusing on those most likely to survive this downturn.