In June, the S&P 500 (^GSPC 1.02%) rose around 6.5%, bringing its year-to-date gains to more than 15%. The index can thank its heavy hitters for the success it's experienced through the first six months of the year. Without the top 44 stocks in the S&P 500, it would be down year to date.

All 11 sectors finished positive for June, with consumer discretionary leading the way. The following companies were the biggest gainers for the S&P 500.

Company June Gains
Carnival Corp. (CCL -0.66%) 68%
Norwegian Cruise Line (NCLH -1.60%) 47%
Generac (GNRC 0.92%) 37%

Data source: S&P Global

After huge rallies in June, investors may be skeptical of now investing in the three companies above. Is that the right thought?

Carnival Corp.

After falling 83% from January 2020 to April 2020 because of the COVID-19 pandemic, Carnival rallied this year and it up more than 130% year to date. Its 68% gain in June was mainly due to some encouraging news surrounding its earnings.

In the second quarter, Carnival's revenue more than doubled to $4.9 billion, a company Q2 record. Its $120 million operating profit in Q2 was also a huge turnaround from its $1.4 billion operating loss in Q2 2022. It's hard to argue against those results.

Given the past few years, it's easy to see why investors may be skeptical of investing now in Carnival, but the company seems to be headed in the right direction.

Its long-term debt (almost $32 billion) is a red flag, and the cost of servicing that debt was a big reason the company reported a net loss of $407 million in the second quarter. But the company has plenty of liquidity and free cash flow will enable it to reduce debt at a fast pace.

Norwegian Cruise Line

Norwegian Cruise Line is another company that's benefited greatly from a recent increase in travel demand. The company said its first-quarter 2023 bookings were higher than Q1 2019 (pre-pandemic). In Q1 2023, revenue of $1.8 billion was almost triple the $521 million in Q1 2022.

Norwegian's Q1 advance ticket sales also sat at about $3.4 billion, up 60% from Q1 2019, and another sign that consumers are beginning to embrace the cruise industry again. The company seems to be preparing for rising demand in the next few years, as it plans to expand its fleet and add nine more ships through 2028.

Still, you have to wonder if the huge demand increase is sustainable long-term. The company had a first-quarter net loss of $159.3 million, which was nowhere near as big as the year-earlier net loss of $982.7 million, but the company still has lost ground to make up.

Generac

Generac is a known for its generators used by residential, commercial, and industrial customers. Hot weather -- particularly in Texas and other southern states -- has driven up the demand for Generac's products and boosted its stock price.

Generac is a cyclical business, with demand increasing much more in summer than in winter. Its Q1 2023 financial results weren't that encouraging -- revenue fell 22% year over year and net income declined almost 90% to $12 million, but it should make a turnaround in the next coming quarters.

There doesn't seem to be much doubt about the effectiveness of the company's products, but its long-term growth potential will depend on how effectively it can penetrate larger markets, mainly Texas, Florida, and California. Generac says those three states combine for 25% of its addressable market, and current penetration is only 3.5% for all three combined.

There's a better approach

Investing in individual stocks has many pros, including the opportunity for outsized returns in a relatively short period. It's much more likely an individual stock will increase 37% to 68% in a month than a broad index like the S&P 500. However, in this case, rather than investing in the companies individually, I would invest in the S&P 500 as a whole via an exchange-traded fund (ETF).

With the chance for high returns with individual stocks comes added risk. An S&P 500 ETF has a natural safety net because of its diversification and the importance of the companies it contains. You can't predict how stocks will perform either way, but an investment in the S&P 500 is an investment in the broader U.S. economy, for all intents and purposes. 

You can be more certain of the S&P 500's long-term potential and ability to weather any economic storm than any of the three listed companies. There isn't much difference between S&P 500 ETFs since they track the same index, but my go-to is the Vanguard S&P 500 ETF because of its low 0.03% expense ratio.