(Bloomberg) -- Merck & Co. notched its best yearly gain in more than two decades, making it the top-performing drugmaker in the S&P 500 in 2022 as investors rewarded the company for strong earnings and upbeat clinical trial data.

The stock has gained 45% this year and is trading near a record high level as the maker of the blockbuster cancer drug Keytruda and HPV vaccine Gardasil got a boost from the company’s solid earnings results. Its Covid-19 therapy Lagevrio brought in billions of revenue, and China approved the antiviral for emergency use this week.

“Merck really went from strength to strength over the course of 2022,” Barclays analyst Carter Gould, who holds an overweight rating on the stock, said in an interview.

Merck has also benefited from positive clinical updates. Earlier this month, a trial showed Keytruda with Moderna Inc.’s cancer vaccine reduced melanoma deaths and in October a late-stage trial of sotatercept, an investigational therapy for pulmonary arterial hypertension, met the main goal. 

The stock’s surge this year has lifted it near the average 12-month target price of analysts, based on Bloomberg data, leaving little apparent return potential for next year. But some still see upside ahead. Earlier this week, Cantor Fitzgerald analysts named Merck a top large-cap pharma stock pick for 2023. Mizuho Securities also dubbed the stock a preferred choice for the year ahead. 

“In our view, MRK is a compelling long-term growth story as it continues to expand franchise cornerstone Keytruda into additional and earlier-line indications,” Mizuho analysts wrote in a note.  

--With assistance from Jeremy R. Cooke.

(Updates share price moves throughout.)

©2022 Bloomberg L.P.