The S&P 500 index has fallen about 4.5% since the Middle East war started. And it continues to drop. As a result, most sectors of the S&P 500 are deep in the red for March (March 2 was the first trading day after the war began).
But not all sectors are down. A few are solidly in the green this month. That begins with energy stocks. With the Strait of Hormuz effectively closed, prices of both crude oil and natural gas have spiked on world markets. The average price of a gallon of gasoline has soared by almost $1.
That's all great news for energy companies and their shareholders. ExxonMobil (XOM -1.11%) is up 3.3% this month, and Chevron has climbed almost 8%. ConocoPhillips is up 11% for the month. Large refiners like Phillips 66, Valero Energy, and Marathon Petroleum are also up by double digits.
The AI build-out is bolstering computer hardware and storage stocks
But gains since the war broke out aren't limited to energy stocks. Several stocks in the computer hardware subsector have also posted strong gains in March.
Sandisk (SNDK -0.96%) was the best-performing stock in the S&P 500 index last year, with an incredible 559% return. It's doing it again in 2026, up more than 210% year to date and 17% since the war started. The company makes flash storage devices that can retain data without a power source.

NASDAQ: SNDK
Key Data Points
Western Digital also makes data storage products, though it's focused on hard drives rather than flash memory. That stock soared last year, up a whopping 282%, and is also putting in a repeat performance in 2026, up 78% this year and 11% in March. International Business Machines and Dell Technologies are also having a very good March. Add to that list Micron Technology, which has climbed more than 7% this month, also driven by soaring memory demand.
It seems computer hardware stocks haven't been dragged down by the war and soaring oil prices because AI-driven demand for servers, storage, and peripheral equipment continues to outpace supply. For the moment, at least, that tailwind remains more powerful for this group of stocks than the headwinds of war-driven inflation and energy concerns.
Cybersecurity stocks are gaining from ongoing geopolitical hostilities
Finally, several stocks in the software infrastructure group have put in banner performances in March. Palantir Technologies, Palo Alto Networks, and CrowdStrike Holdings are each up more than 10% since the beginning of the Middle East conflict. It's no wonder, as the three companies are leaders in AI-driven security and data analytics, including cybersecurity. Sophisticated modern warfare is obviously going to drive demand for the products those companies offer.
Image source: Getty Images.
Oracle (ORCL +2.06%), also in that group, is up nearly 7% in March. Its stock is being rewarded by the company's big AI contract wins and a huge surge in cloud infrastructure revenue.
If you look at a market heatmap like Finviz, those three sectors -- energy, computer hardware, and cybersecurity -- are basically the only real pockets of green in a giant sea of red since the war began, as soaring oil prices continue to weigh heavily on most other sectors and will probably continue to do so until crude retreats back to under $100 a barrel.

NYSE: ORCL
Key Data Points
Whether you should consider an investment in energy stocks depends, at least in part, on how long you expect the war to continue and oil prices to remain elevated. Demand for AI-infrastructure stocks looks to continue through 2026. And cybersecurity stocks could see ongoing demand as cyber warfare doesn't look to decrease any time soon.



