Iran jitters helped push oil prices higher but a broader stabilization of crude futures near 3½-year highs can be tied to several big, prevailing trends. Strong global oil consumption has come up against a 1½ -year-old deal led by OPEC and Russia to manage crude supply among producers. And while U.S. drillers are slowly and steadily increasing their output, Venezuela's production continues to drop amid its economic crisis.
Investors have also been encouraged by a rotation in the market that has benefited energy stocks, healthy mergers and acquisitions activity in the oil patch and positive first-quarter earnings.
An earlier plunge in energy stock prices whittled away at the energy sector's weighting in the S&P 500. It recently fell to about 5.4 percent compared with 7 percent to 12 percent between 2005 and 2014, the year oil prices tanked, according to energy-focused investment bank Simmons & Company.
The fact that energy stocks are outperforming other sectors is the biggest factor in fueling the breakout, in Simmons's view.
"Happy days have seemingly returned for energy as relative stock price performance has been impressive and has galvanized an indifferent buyside into greater levels of participation," analysts at Simmons & Company said in a research note this week.
Energy stocks have also benefited from the technology sector's loss of momentum at times this year. While the sector is still the biggest winner this year, its stumbles have pushed some investors into energy stocks, said Jay Hatfield, co-founder and president of Infrastructure Capital Advisors.
"The momentum in the tech stocks was so powerful last year, it took the change in the calendar year to slow that down because of tax considerations," said Hatfield.
"There was a pretty huge macro trade where macro hedge funds were long growth and short value. Basically that means being long tech and short energy," he said.
While energy and tech stocks appeared to be negatively correlated recently, they are now on the same upward path. That leads Hatfield to believe the trade has once again flipped, with investors now going long riskier names and short defensive stocks like utilities and real estate investment trusts.
Over the last month, the energy sector is up 8.6 percent, while tech stocks have risen 6.7 percent. The next best performing sector is consumer discretionary, which has returned 3.2 percent in the last 30 days.
The market is also seeing the type of consolidation within the fragmented U.S. oil patch that it has long anticipated. Concho Resources announced in March it would buy fellow Texas driller RSP Permian, promising $2 billion in cost savings. Last month, Marathon Petroleum said it would pay $23 billion for Andeavor, creating the nation's largest independent refiner.
To be sure, the rise in oil prices this year to the $70 to $80 a barrel range is an undeniable factor. But Rob Thummel, an energy portfolio manager at Tortoise Capital Advisors, said it's not just the rally that matters, but the belief that crude futures will stay within $5 a barrel, plus or minus, of current prices.
"What you need for investors to return back to the energy sector is stable oil prices," said Thummel. "Investors are getting comfortable with where oil prices are. Volatility is not going to be 100 percent. With that is going to bring better earnings."
S&P 500 energy companies have posted 86.5 percent earnings growth in the first quarter, according to a Thomson Reuters I/B/E/S analysis of corporate reports through Thursday morning.
Energy executives are also telling investors what they want to hear in quarterly conference calls, said Thummel.
"Oil producers are not going to spend more because they have more cash flow. They are actually going to be focused on returning value to shareholders," he said.
In the view of Simmons, the best subsectors are still U.S. independent drillers and oil majors like ExxonMobil and Chevron. The bank says both could run up 25 percent to 30 percent with U.S. crude prices at $60 and international benchmark Brent crude at $60 to $65. On Friday, U.S. crude was trading near $71 a barrel, while Brent was above $77 a barrel.
Simmons also says that oilfield services companies, notable laggards, have seen a "cathartic stock price performance." However, the bank says it remains to be seen whether shares will continue to run up given estimates for future earnings look "ambitious."