(Bloomberg) -- A boom in artificial intelligence fueled a blistering first half for the US stock market, and traders expect to see the same — and more — in the remainder of the year.

The S&P 500 Index has climbed 14% since the beginning of January, notching its second-best stretch of records to start a year this century, thanks to a resilient economy, improved corporate earnings and torrid demand for companies linked to AI. Even with signs of economic cooling, the rally is getting help from a Federal Reserve that’s considering when to trim rates after the most disruptive tightening campaign in decades.

A strong first-half in the stock market has historically boded well for the rest of the year. Whether that will be the case again is anyone’s guess, considering wild cards on the horizon. The US presidential election in November — which may move stocks haywire — is one of them. Uncertainty about the path of interest-rate cuts is another. 

After a 500-plus session drought without a record to start the year, the S&P 500 has notched 31 all-time closing highs in 2024 during the January-June period, according to data compiled by Bloomberg. Only one other year surpassed it this century, 2021.

The S&P 500’s current bull run has added more than $16 trillion in market value since a closing low of 3,577.03 on Oct. 12, 2022. It now trades within striking distance of 5,500.

Companies in information technology and communication services fueled gains. Those sectors house a handful of tech behemoths including Nvidia Corp., Microsoft Corp. and Meta Platforms Inc. Information-tech stocks have advanced 28% in 2024 and communication services shares are up 26%.

Utility stocks have risen by 7.6%, as investors bet they will benefit by providing energy to data centers tied to the ascent of AI. Real estate is the lone sector with losses in 2024, posting its worst first half ever relative to the broad index since it was created in the late-1990s, data compiled by Bloomberg show. High interest rates have hurt the sector.

AI chipmaker Nvidia contributed the most to the S&P 500’s rally in 2024. Even with a recent pullback, it rallied roughly 150% on a total return basis. Runners-up are Constellation Energy Corp., rising nearly 72%, followed by General Electric Co., Eli Lilly and Co., and Micron Technology Inc.

Walgreens Boots Alliance Inc. was the worst performer, shedding 52% thus far in 2024.

In terms of index-point contributions, Nvidia also holds the top spot, adding 218 points. Microsoft added 64 points, while Amazon.com Inc., Meta and Apple Inc. rounded out the top five. Tesla Inc. posted the biggest losses with 17 points.

Some strategists say the rally in tech stocks looks overblown, with rich valuations and just a handful of high flyers pushing the market skyward.

An equal-weight version of the S&P, which makes no distinction between the size of the companies, has trailed the version that is weighted by market value by 10 percentage points since the beginning of January. That is the widest underperformance in the first six months of the y

ear ever.

Companies outside of tech may juice the next leg higher for stocks, according to Jim Paulsen, a well-known stock strategist who correctly called the S&P’s double-digit rise last year. Since 1990, four prior bull runs saw the equal-weight index outpace the main benchmark by 15 percentage points, on average, by the 20th month, according to Paulsen. Currently, the equal-weight gauge has underperformed the S&P by 16 percentage points in that span.

A strong first half for the S&P has typically led to another solid run in the remaining six months. Since the early 1950s, when the index climbs more than 10% through June, it rises by a median of roughly 10% in the second half, data compiled by Bloomberg show.

While the market is historically weaker in the first half of US presidential election years, this is the second-best January-June run since 1928, according to Ned Davis Research. With stocks bucking seasonal patterns, it leaves room for the S&P to pull back between 5% to 8%, starting in the coming weeks, per Jeffrey Hirsch, editor of the Stock Trader’s Almanac, who correctly forecast the rally after the 2008 global financial crisis.

©2024 Bloomberg L.P.