Since the start of the year, all three major indexes have rallied. The S&P 500 and the Nasdaq have even climbed in the double-digits. This has been a great relief for investors after the benchmarks fell into bear territory last year. Though we haven't yet shifted into a bull market, there's reason to be optimistic about what's ahead. Bull markets always follow bear markets. So, we can be sure one is on the way (even if we don't know when it will arrive).

Most sectors have participated in this wave of gains since the start of the year. But two in particular have contributed the most. Now you may be wondering if more gains are ahead for these particular industries -- and if you should buy some of the stocks with the most momentum. Let's find out.

Leading first-half gains

First, a look at these industries that have done so well in the first half of 2023. Follow me to the chart below for details. As the chart shows, technology and consumer discretionary stocks have led gains. These sectors have contributed more than 61% and 18%, respectively, to the S&P 500 rally since the start of the year.

The chart shows technology and consumer discretionary stocks contributed most to this year's rally.

Source: Statista.

As the chart also shows, the industries that have outperformed are those that are linked to growth. For example, other gainers include industrials and financials. The underperformers include sectors that investors often run to for safety -- such as healthcare and consumer staples stocks.

Before we consider whether you should buy the strongest-performing sectors, let's consider how some of this year's winners performed last year. In technology, Apple (NASDAQ: AAPL) and Alphabet (NASDAQ: GOOG) (NASDAQ: GOOGL) soared in the double-digits in the first half -- after dropping in the double-digits last year.

In consumer discretionary, Lululemon Athletica (LULU -0.44%) and McDonald's (NYSE: MCD) are climbing in the double-digits, also after losses last year. Meanwhile, Carnival (NYSE: CCL) (NYSE: CUK) is soaring in the triple-digits after a poor performance in 2022.

So, many of this year's top performers suffered last year. Does this mean we're looking at just a technical rebound right now? Not necessarily. Back in 2022, investors worried about the impact of rising inflation on companies -- and as a result, many of them stayed away from those most sensitive to the economy.

Signs of good health

Today, the economic situation is still difficult. But many of these companies have shown signs of good health in spite of the headwinds. For example, Carnival is making progress on the path back to profitability and lowering its debt. And Alphabet still managed to increase revenue in the most recent quarter and grow its cloud business. This means that, in many cases, companies have reassured investors -- giving them reason to return to stocks linked to consumer spending.

Now, let's talk about what you should do next. Is now a good time to invest in these industries that led the rally in the first half? Yes and no. Here's what I mean. I wouldn't broadly favor all technology and consumer discretionary stocks. But, on a case-by-case basis, I would take a look at some of the players that have momentum -- and explore whether they could continue to climb over the long term. If they don't soar in the second half of the year, that's OK. The main point is to determine whether they have what it takes to move higher over time.

A solid long-term stock

One stock that has this potential is Lululemon. The maker of yoga-inspired clothing met all goals in its growth plan during earlier stages of the pandemic -- a time that wasn't particularly easy for retail. The company continues to report gains in earnings and is on track to meet the goals of its latest plan. That's to double annual revenue by 2026. And in spite of gains, Lululemon trades for about 31 times forward earnings estimates, which is very reasonable for a growth stock.

All of this means that, as always, looking at each stock individually is key. Some that may have soared in the first half might not make good long-term buys -- even if they continue to climb a bit more this year. And others may just be getting started when it comes to gains -- but those gains will come over the long term.

I wouldn't invest in all of the first half's winners. But by choosing carefully, you could find yourself with a portfolio that might help you grow wealth over time.