Last year was a roller-coaster ride for the S&P 500 (^GSPC -0.38%). The market index hit record highs late last year before falling into correction territory, then ended the year down more than 6%. Many of the companies that make up the storied index saw similar trajectories.

That doesn't mean that every stock ended in the red, however, as the top performers beat the market by a wide margin. Let's take a look at the top five stocks in the S&P 500 as measured by S&P Global Market Intelligence.

AMD Radeon Instinct GPU.

AMD Radeon Instinct GPU. Image source: AMD.

1. Advanced Micro Devices: Up 80%

Advanced Micro Devices (AMD -3.63%) experienced the same turbulence as the overall market, but finished the year strong as the best-performing stock in the S&P 500. Customers were snapping up its Ryzen desktop processors and EPYC server chips. Its graphics processing units (GPUs) found strong demand in a wide variety of use cases including gaming, cloud computing, and data centers. AMD also benefited from the cryptocurrency boom in early 2018, though that came to an end in the back half of the year.

AMD hasn't yet reported the results of its final quarter for 2018, as of this writing. For the first nine months of the year, AMD grew revenue to $1.9 billion, up 29% year over year, while expanding its gross margin to 38% from 34%. Net income grew to $299 million compared to a loss of $14 million in the prior-year period. 

Check out the latest Advanced Micro Devices earnings call transcript.

Female doctor cupping a plastic heart

Growing adoption of ABIOMED heart pumps drove gains. Image source: Getty Images.

2. ABIOMED: Up 73%

ABIOMED (ABMD) had a banner year as well, though at one point the stock was up well over 100%. What drove its impressive gains? The maker of minimally invasive Impella heart pumps continues to gain converts, as the company's data shows that use of the device results in shorter hospital stays and lower readmission rates. A recent study showed that the Impella increased survival rates by 24% in patients with cardiogenic shock. Penetration rates in the U.S. continue to rise, and the company is continuing its push into international markets.

In its 2019 fiscal second quarter, which ended on Sept. 30, 2018, ABIOMED grew revenue to $362 million, up 37% year over year; but its profits were what really shined, topping $140 million, up more than 126% compared to the prior-year quarter. This marks the third consecutive quarter of triple-digit net income gains. The reorder rate of its Impella heart pump continues to be strong at around 100%. 

Check out the latest Abiomed earnings call transcript.

A padlock overlaid with computer circuits.

A wave of security breaches has helped lift Fortinet. Image source: Getty Images.

3. Fortinet: Up 61%

Fortinet (FTNT 0.14%), a global cybersecurity provider, has been riding the recent wave of security breaches, data theft, and online fraud. The company uses artificial intelligence for advanced behavioral-threat detection in its latest-generation firewall. The industry is taking notice. Market research company Gartner has recognized Fortinet as a leader in two of its Magic Quadrants research reports in 2018, and the company appeared in seven during the previous 12 months. Ahead of the recent market unpleasantness, the stock was up more than 100%, before settling for its market-beating gains.

For the first nine months of 2018, Fortinet reported revenue of $473 million, an increase of 20% year over year, while net income grew 148% to $150 million. Deferred revenue -- which signals future demand -- is growing even faster, with $1.54 billion at the end of the third quarter, up 27% year over year. Subscriptions amounted to 62% of total revenue during the period, and that number is accelerating, to nearly 64% in the third quarter.

Check out the latest Fortinet earnings call transcript.

A man in a hoodie looking at engine oil in an auto parts store.

Aging cars and more miles bode well for Advance Auto Parts. Image source: Getty Images.

4. Advance Auto Parts: Up 58%

Advance Auto Parts (AAP 0.40%) is a provider of automotive replacement parts and maintenance items for consumers and commercial enterprises under the Advance Auto Parts, Autopart International, Worldpac, and Carquest brand names. The company has seen its turnaround finally bear fruit, and it's also benefiting from the increasing number of miles driven and the number of aging vehicles on the road in the U.S. The company recently announced a partnership with Walmart to create an automotive specialty store on Walmart.com, which should boost sales further. 

During the first nine months of 2018, Advance Auto Parts grew net sales to $7.5 billion, an increase of 1.9%. Comparable-store sales jumped 2% year over year, driven by increases in units per transaction and average ticket value. That accelerated during the third quarter, with comps rising by a whopping 4.6%. Net income grew an impressive 27% year over year to $370 million. 

Check out the latest Advance Auto Parts earnings call transcript.

A plane taking off into the sunset.

Image source: Getty Images.

5. TripAdvisor: Up 56%

Online travel-booking specialist TripAdvisor (TRIP 0.08%) had a banner year in 2018, after a notable plummet the year before. The company has long sought to move beyond its signature online travel reviews into direct booking services, and this year showed signs that its long-awaited turnaround might finally be taking hold. This was evidenced by the dramatic increase in its non-hotel business over the course of the year. 

For the nine months ended Sept. 30, 2018, TripAdvisor grew revenue to $1.27 billion, up 3% year over year, while its net income climbed 62% to $105 million. Those figures accelerated in the third quarter, growing 4% and 176%, respectively. The bottom line was driven by cost discipline, as marketing expenses fell to $206 million, down 17% year over year, and now represent 45% of revenue, down from 56% in the prior-year quarter. Additionally, average monthly visitors grew to 490 million, up 8% year over year. 

Check out the latest TripAdvisor earnings call transcript.