After brutal losses to end 2018, the biotech sector is off to the best start of the year since 2012.

Two new deals to start the year and positive trial presentations at the J.P. Morgan Health Care Conference have breathed new life into some of last year's biggest stock losers.

The iShares Nasdaq Biotech Index gained 13 percent in the first eight trading days of the year, finishing lower just one day since the market sell-off on Dec. 24. It marks a major reversal following a 20 percent plunge in the index in the fourth quarter.

Takeover speculation has been a major catalyst for the rally. Bristol-Myers Squibb's $74 billion deal to buy oncology drugmaker Celgene helped fuel takeover speculation, which was quickly reaffirmed by Eli Lilly's $8 billion deal for cancer gene therapy biotech Loxo Oncology at the start of the J.P. Morgan health conference on Monday.

Eli Lilly agreed to acquire Loxo Oncology at a 68 percent premium, which has sent the acquirer's stock down more than 8 percent for the year. Loxo surged 66 percent this week to about $232 a share, but the targeted gene therapy drugmaker was already a market outperformer, having gained 66 percent in 2018.

Positive trial data presented at the J.P. Morgan conference also drove big gains in the sector. Sage Therapeutics shares soared after the company reported positive late-stage data on its treatment for postpartum depression. The stock gained nearly 30 percent so far this week, closing at $126.22 a share Thursday, after a near 42 percent loss for the year in 2018.

Amarin shares more than tripled in 2018, and this week the company's shares soared another 39 percent through Thursday's close of $18.35. Ahead of the conference, the company issued a conservative sales outlook for its new heart drug Vascepa, which was slightly below analyst estimates. But investors came away with a more bullish outlook from CEO John Thero's presentation.

"Although nothing new was presented … the sentiment was positive from those investors we spoke with who attended the meeting," wrote Cantor Fitzgerald analysts in a note to clients. They added that physician feedback on the drug was positive and "cardiologists in particular are appreciating the data and moving to prescribe Vascepa to patients, according to the company."

Part of the biotech rally may be due to the oversold nature of the sector. Biotech was among the market's most oversold sectors in 2018, declining nearly 10 percent last year. A number of this week's biggest gainers remain firmly in bear market territory.

Other health-care sectors that saw gains in 2018 got less of a tailwind from this week's conference.

The index that tracks large-cap drugmakers, the NYSE Arca Pharmaceutical Index, is flat for the start of the year after gaining more than 4 percent in 2018.

Similarly, the broader S&P 500 health-care sector, which was the blue chips' best performing sector in 2018, has underperformed the broader market in the new year, and is now up about 1 percent.

Correction: This story has been revised to clarify that it is Eli Lilly that has agreed to acquire Loxo Oncology.

— Follow Bertha Coombs on Twitter @coombscnbc