Overall, the S&P's fourth quarter earnings are up 2%, but all of that is thanks to the FAAMG stocks. Without these 5 stocks, the index's year-over-year earnings growth is flat.

After crunching the data from the 397 S&P components that have reported earnings so far this quarter, the firm found that "FAAMG" — or Facebook , Amazon , Apple , Microsoft and Google parent Alphabet — grew their fourth quarter earnings by 16% year-over-over.

The stock market may be hovering around all-time highs, but just 5 companies are contributing to the S&P 500's earnings growth, Goldman Sachs said in a new note.

"Mega-cap earnings strength contrasts with small-cap earnings weakness," the firm's analysts led by David Kostin said in a note to clients. "The Russell 2000 experienced a 7% earnings decline during the fourth quarter, as many smaller firms posted weak top-line growth and had difficulty absorbing rising wages and other input costs."

All five stocks are also outperforming the broader market this year, with Microsoft leading the way after gaining more than 18%, compared with the S&P 500's 4% rise.

The "FAAMG" basket accounts for 18% of the total S&P 500 market cap. The last time value was this concentrated among five stocks was during the tech bubble in 2000, when Microsoft, Cisco, General Electric, Intel and Exxon Mobil were the index's five largest companies.

But this time around Goldman said the market's composition appears to be on firmer ground.

"Lower growth expectations, lower valuations, and a greater re-investment ratio suggest the current concentration may be more sustainable than it proved to be in 2000," Kostin wrote in a Jan. 31 note.

Microsoft is currently the largest company in the S&P 500, with a market cap of $1.4 trillion. Apple is next, standing at $1.39 trillion, with Amazon and Alphabet at $1.07 trillion and $1.04 trillion, respectively. Facebook rounds out the top 5 with a value of $619 billion.

So far this quarter 71% of companies have beat earnings estimates, while 65% have topped revenue expectations, according to data from Refinitiv.

Subscribe to CNBC PRO for exclusive insights and analysis, and live business day programming from around the world.

- CNBC's Michael Bloom and Nate Rattner contributed reporting.