What happened

Shares of Alphabet (GOOG 0.72%) (GOOGL 0.83%) posted strong gains in the first half of 2023, overcoming initial fears that the company was falling behind Microsoft (MSFT 0.74%) in the AI race and that Google Search could get disrupted by OpenAI's ChatGPT. 

Instead, the stock rallied as it seemed to get through the worst of the slowdown in digital advertising and after it impressed investors with its Bard AI chatbot at its I/0 Conference in May.

According to data from S&P Global Market Intelligence, Alphabet finished the first six months up 36%, outperforming the 15.9% gain for the S&P 500.

As you can see from the chart below, the stock separated from the broad-market index in March and surged again in May after its developer conference.

^SPX Chart

^SPX data by YCharts.

So what

Alphabet came into 2023 looking undervalued. The stock traded at a discount to the S&P 500 after revenue growth slowed sharply in 2022 due to a slowdown in the digital-ad market. However, the stock first got a bump in January after announcing plans to lay off roughly 12,000 employees, joining other tech stocks in cutting costs at a time when revenue growth is slowing as the industry rolls off the pandemic boom. 

The stock then popped after its fourth-quarter earnings report in early February, overcoming muted expectations. The stock rose 7% on Feb. 2 as revenue increased 1%, or 7% in constant currency, to $76 billion, and earnings per share (EPS) fell from $1.53 to $1.05, showing the challenges in the current advertising environment. Though the company missed estimates with both those figures, investors seemed to like the company's focus on AI.

The following week, the stock fell 12% over a two-day span as Microsoft first announced a new version of Bing, powered by ChatGPT, and Alphabet unveiled its own AI chatbot, Bard. But it disappointed in its debut as Bard made some factual errors.

In mid-March, the stock bounced back, seemingly on Congressional threats against TikTok, a key competitor to YouTube, and on some analyst chatter that Google Search was holding strong in the face of competition from the new Bing and ChatGPT.

The stock got a modest boost after reporting Q1 earnings in late April as it beat top- and bottom-line estimates.

Finally, shares rallied in May as the company impressed analysts with an upgraded version of Bard at its I/0 Conference.

Now what

Alphabet doesn't give guidance, so investors don't have a great sense of what to expect in the second half of the year, but the company will be up against easier comparisons both in the ad market and in currency exchange, which should support an acceleration in revenue growth. 

Still, generative AI does represent a threat to the company, especially in Search, and it's likely to put a ceiling on the stock until Alphabet can prove it's not an issue. At its current price-to-earnings ratio of 26, the stock seems fully valued, especially given the risks in AI.