Energy stocks have remarkably outperformed their tech counterparts over the past three months. The driving force behind this surge? A resounding oil rally.

WTI-graded crude oil has experienced a remarkable ascent of over 30% since mid-June.

This dramatic increase can be attributed to a combination of factors, including supply constraints resulting from production cuts by Saudi Arabia and Russia, as well as a robust U.S. economy that has sustained demand for oil.

During the first semester, the Nasdaq 100 index, represented by the Invesco QQQ Trust (QQQ  ), exhibited a staggering 39% increase, marking the best first half of the year since the inception of the index.

Much of this surge was fueled by the artificial intelligence (AI) boom, which catapulted tech stocks to new heights, defying the interest rate gravity.

Nonetheless, during the last three months, the tech-dominated index has displayed a flat performance, suggesting a stalemate in the previously prominent AI-fueled surge that defined the earlier market landscape. In contrast, energy stocks, as monitored through the Energy Select Sector SPDR Fund (XLE  ), have experienced significant upward momentum, rising by 19%.

The largest energy stock - Exxon Mobil Corp. (XOM  ) - showcased a similar outperformance over the largest tech stock - Apple Inc. (AAPL  ) - over the same time period.

This interaction between the energy and tech sectors could potentially signal a reversal of the trend dynamics that were in play earlier this year.

Oil To Beat AI?

In this three-month period, AI-related exchange-traded funds (ETFs) have closely mirrored the performance of the broader tech sector, offering little to no hedge against the shifting market trends.

The Global X Artificial Intelligence & Technology ETF (AIQ  ) has experienced minimal movement, remaining relatively flat. On the other hand, the First Trust Nasdaq Artificial Intelligence and Robotics ETF (ROBT  ) has declined by 8.7%.

In stark contrast, oil-related ETFs have seen substantial rallies. The VanEck Oil Services ETF (OIH  ) has surged by an impressive 30%, and the SPDR S&P Oil & Gas Exploration & Production (XOP  ) is up by a robust 18%.

Year-to-date performances are still giving tech the lead, but what if oil prices hit $100 a barrel soon?