Earnings beats from UnitedHealth Group Inc. (UNH - Get Report) and Johnson & Johnson (JNJ - Get Report) led the healthcare sector to recover from a days-long presidential beating.

The sector has had a rough few sessions after President Donald Trump cut off subsidies to insurance companies as a way to undermine Obamacare and then railed against drugmakers for "getting away with murder." Trump and congressional Republicans have worked to repeal the Affordable Care Act first through legislation, a process that failed to deliver the votes, and now by executive order. 

Uncertainty for the sector led to recent losses. From Thursday, Oct. 12 to Monday, Oct. 16, the Health Care SPDR ETF (XLV - Get Report) declined by 0.8% and the iShares NASDAQ Biotechnology Index ETF (IBB - Get Report) fell 0.6%. 

However, a solid quarter for UnitedHealth and Johnson & Johnson delivered gains for industry peers. UnitedHealth reported a 26.3% increase in net earnings for its third quarter, while adjusted earnings of $2.66 a share beat estimates by a dime. Overall revenue increased nearly 9%, driven by an 8.4% gain in its pharmacy benefit management unit. 

UnitedHealth surged more than 5% and was on track to close at a new record with its best price gain since going public in 1984. 

Meanwhile, Johnson & Johnson gained 2% after beating earnings estimates and raising its full-year profit guidance. Pharmaceuticals revenue increased 15% over its recent quarter, while medical device sales in the U.S. rose 7%.

The two were the best performers on the Dow Jones Industrial Average on Tuesday, Oct. 17. Other health stocks on the rise included AbbVie Inc. (ABBV - Get Report) , Celgene Corp. (CELG - Get Report) , Bristol-Myers Squibb Co. (BMY - Get Report)  and Biogen Inc. (BIIB - Get Report) . The SPDR ETF increased 1%. 

Join us in New York City on Nov. 30 for The Deal Economy Conference, where leading industry experts and other influential members of the deal community will gather to discuss key issues that will confront dealmakers in 2018.

Join Jim Cramer, CNBC's Jon Najarian and Other Experts Oct. 28 in New York

Jim Cramer will host CNBC's Jon Najarian, TD Ameritrade's JJ Kinahan, famed analytics expert Marc Chaikin and other market mavens on Oct. 28 in New York City to share successful strategies for active investors.

You can join them as they discuss how smart investors can make the most of options trading, futures contracts, fundamental and quantitative analysis and great ETFs to buy right now. Participants will also get a chance to meet Jim and other panelists and take photos.

When: Saturday, Oct. 28, 8 a.m.-3 p.m.

Where: The Harvard Club of New York, 35 West 44th St., New York, N.Y.

Cost: $250 per person.

Click here for the full conference agenda or to reserve your seat now.

More of What's Trending on TheStreet: