After one of the best years for the stock market that CNBC's Jim Cramer can remember, he wanted to get a better snapshot of the gains (and see what's ahead) by looking at the . One of Wall Street's most relied-upon indexes, the S&P helps shed light on last year and, if analyzed properly, can make investors money in 2018, the "Mad Money" host said. So Cramer went over the S&P's top performers for 2017 to see what they reveal about this year's layout, starting with the best of the best.

1. NRG Energy

The S&P's biggest winner in 2017 was NRG Energy, a utility play that spent much of 2015 and 2016 in the doghouse due to mismanagement. "But in 2017, NRG rose, Lazurus-like, and finally made it all the way back to where the stock was at the start of 2015" thanks in part to an activist push to get the company back on its feet, Cramer said. "It's up 132 percent, but I think the easy money's been made here. If I owned NRG, I'd be a seller — don't give back those gains."

2. Align Technologies

Cramer-fave Align Technology came in second for the S&P's winners, logging a 131 percent annual gain in 2017. Even though more bearish voices claim the market for Align's invisible teeth-straightening products is saturated, Cramer held on to his bullish thesis for the dentistry play. "Align still has very little overseas penetration and very little competition," he said. "Have a heart-to-heart with your dentist about this one. There just aren't enough cavities to go around to keep their businesses thriving anymore. But there are plenty of crooked teeth that need to be corrected before you Snap."

3. Vertex

Drugmaker Vertex was the third-best stock in the S&P for 2017 with a 103 percent annual gain. Cramer said the company's success with its cystic fibrosis treatment drove much of the move. "There was plenty of skepticism about these guys and their clinical trials, but the drug came through and that should be huge for the company," he said. "I bet there could be even more to come, even a possible takeover here, given how starved big pharma is for new drugs."

4. Wynn Resorts

Cramer likes when company insiders tell investors what to do with their stocks, like CEO Steve Wynn did with Wynn Resorts, the S&P's fourth-best winner in 2017. Wynn bought his own company's stock when it was in the mid-$50s and $60s several years ago, betting that the hotel giant's Macau casino would far exceed performance expectations. "He was right, and it helped boost the stock by 95 percent last year," Cramer said. "I'm not deterred at all that Wynn Macau's numbers took a drop recently. I think that it can come roaring back. I think you'll regret dumping the stock."

5. Boeing

Boeing was the S&P's fifth-best stock and the Dow Jones industrial average's No. 1 winner. Cramer covered the aerospace colossus in-depth in a recent Dow stocks round-up. "As much as I like most of the winners from the S&P, their moves seem a little more exaggerated and possibly more ephemeral than their counterparts in the Dow, especially Boeing," he said.

6. Micron

Commodity chipmaker Micron came in sixth for the S&P's top performers, but its stock has been treading water since the company's latest quarter, which beat analysts' expectations. "That's not a good sign for a tech company because the action is telling you that something real bad may be lurking around the corner," Cramer said. Potential negatives for Micron include a peaking flash memory chip market and an upcoming peak in the market for DRAM chips, as well as potential overvaluation for Micron's shares, Cramer said. "I think Micron's merely going to mark time after its stellar 88 percent gain last year," he said. "I do prefer Nvidia or Broadcom."

7. D.R. Horton

For Cramer, the S&P's seventh-best performer was also one of the most surprising. Shares of homebuilder D.R. Horton ran 87 percent in 2017 despite some contradictory economic action. "These are precisely the stocks that must be sold as soon as the Fed starts tightening," the "Mad Money" host said. But with mortgage rates not yet reflecting the Fed's latest interest rate hike, a housing shortage sweeping the country and the new tax code's passing igniting domestic stocks, D.R. Horton's gains can be justified, Cramer said. "Finally, as the largest homebuilder by volume with a low price point for their houses, DR Horton's the ideal company for, yes, millennials, who at long last are moving out of expensive rental apartments or their parents' basements," Cramer added.

8. PayPal

PayPal, another Cramer-fave, took eighth place among the winners of the S&P, with shares also up 87 percent for 2017. "I credit CEO Dan Schulman with much of the gain because he took PayPal from being a decent division of eBay into a company that's become the ultimate financial juggernaut, the millennial way to pay the bills," Cramer said. "I think that the stock has more room to gallop, even after its incredibly strong start to 2018, because it hasn't even begun to monetize Venmo, the millennial way to split bills," he continued. "If PayPal ever gives you a real pullback, I could see it being a takeover target."

9. Nvidia

Up 81 percent for 2017, Nvidia was the S&P's ninth-best stock, and Cramer said the chipmaker's top end-markets — gaming, cloud, artificial intelligence and data centers — aren't showing signs of slowing in 2018. "But these same chips are used to mine bitcoin, and as long as it's linked to that cryptocurrency, Nvidia's going to have some weak-handed shareholders," Cramer said. "Let's hope they were all shaken out by the recent morose behavior of this fabulous stock."

10. PulteGroup

Like D.R. Horton, homebuilder PulteGroup, tenth in the S&P's top brass, benefited from the shortage of cheap housing with a 81 percent annual gain. "I think Pulte had too big a move versus what can happen now with the Fed's tightening. I also think that both these stocks have been the subject of short squeezes because of the way the hedge fund playbook says you need to bet against housing companies at this stage of the game," the "Mad Money" host said. While Cramer didn't think either homebuilding stock would get taken down drastically in 2018, he said that the Fed's rate hike agenda would likely stem their gains.

Final thoughts

"When you look at the top performers in the S&P, you see some very big and, in some cases, very unsustainable wins," Cramer concluded. "But I think PayPal for earnings momentum, Align and Wynn on earnings surprises, Nvidia on a strong product line (that you will hear about, by the way, when the unbelievably brilliant, visionary CEO Jensen Huang speaks this weekend at CES), Vertex on a potential takeover and Boeing on general excellence, can indeed deliver some very fine performance in 2018." For more on Cramer's S&P 500 analysis, get his take on the index's bottom 10 stocks here.

WATCH: Cramer on the S&P's best stocks in 2017