U.S. stocks have been on a tear this year, with the S&P 500 and Nasdaq Composite scoring their strongest first seven months of a year in decades, according to Dow Jones Market Data. 

The S&P 500
SPX,
+0.15%

booked a 3.1% gain in July that increased its year-to-date rise to around 19.5%, according to FactSet data. The Nasdaq Composite
COMP,
+0.21%

advanced slightly more than 4% this month, bringing the technology-heavy index’s massive gains so far this year to 37.1%. 

The Nasdaq saw its best first seven months of a year since 1975 when the index surged 39.1% over that stretch, according to Dow Jones Market Data. The Nasdaq went on to give up some of those gains in 1975, but still finished the year up almost 30%, FactSet data show. 

The S&P 500 just wrapped up its best performance through the first seven months of a year since 1997, when it gained 28.8% through July, according to Dow Jones Market Data. The index rose 31% in all of 1997, FactSet data show.

U.S. stocks have been soaring this year after suffering big losses in 2022 as the Federal Reserve aggressively raised interest rates to combat high inflation. The cost of living in the U.S. remains elevated, but it’s been easing even as the economy continues to expand and the Fed slows its rate hikes in 2023. 

Read: Citigroup raises S&P 500 target for 2023 on increased chances of ‘soft landing’

Meanwhile, the corporate bond market has been signaling confidence this month in company cash flows, flashing a “green light” for further stock gains this year, according to DataTrek.

While Big Tech stocks have fueled the S&P 500’s gains so far in 2023, there have been signs of the stock-market rally broadening.

Equity and quant strategists at Bank of America said earlier this month in a BofA Global Research note that they expected June’s broadening of the rally to continue in the second half of 2023. That’s after just 25% of stocks outperformed the S&P 500 in the first six months of 2023, marking the narrowest first-half breadth ever, they said in the note.

Also see: The ‘narrow breadth’ chorus has fallen silent. What broadening participation in stock-market rally means for investors.