Johnson & Johnson's mounting legal costs ate into its first-quarter profits, which dropped 14% as it fights thousands of lawsuits over its talc baby powder and shelled out almost $400 million to settle 25,000 cases over its blockbuster blood thinner Xarelto.

Still, the health company on Tuesday reported better-than-expected earnings, and its shares closed up more than 1%. J&J reported first-quarter net income of $3.75 billion, or $1.39 per share, down 14% from $4.37 billion, or $1.60 per share a year earlier. When adjusted, J&J earned $2.10 per share, above the $2.03 per share expected by analysts surveyed by Refinitiv.

"The strength of our first quarter results reinforce the confidence we have in our broad-based business," Chief Financial Officer Joseph Wolk said Tuesday on a call with analysts. "We continue to manage our portfolio with discipline and make investments across the enterprise that position as well to achieve long-term sustainable growth across three vital aspects of health care."

J&J's legal expenses have mushroomed in recent months. The company spent $423 million on litigation expenses during the first quarter, on top of $1.29 billion during the fourth quarter. Its legal costs during the first quarter of 2018 rounded to zero.

The company is defending itself in thousands of lawsuits accusing the company's talc baby powder of causing cancer. However, a bulk of its legal costs during the first quarter came from J&J's settlement of more than 25,000 lawsuits over the blockbuster blood thinner Xarelto, spokesman Ernie Knewitz said. The $775 million settlement was split with its European partner on the drug, Bayer, leaving J&J with a $387.5 million bill, he said in an email.

"While there have been several trials where juries have awarded significant verdicts against Johnson & Johnson [in the talc cases], each one that has been heard on appeal have been overturned," Knewitz said. The talc litigation accounted for just 10% of the company's $1.29 billion in legal costs during the fourth quarter, he said.

Sales barely budged, rising to $20.02 billion from $20.01 billion during the first three months last year. Analysts expected a decline to $19.61 billion.

More than half its revenue came from prescription drug sales, which rose to $10.24 billion from $9.84 billion in the year-earlier quarter. Analysts were expecting revenue of $9.83 billion, according to estimates compiled by StreetAccount.

The company narrowed its full-year earnings forecast to a range of $8.53 to $8.63 per share from its previous estimate of between $8.50 and $8.65. It didn't change its projected sales of $80.4 billion to $81.2 billion for 2019.

Prescription drug sales helped boost earnings, despite new generic drug competition against its Zytiga prostate cancer drug.

Zytiga lost its patent protection last year, and its sales during the first three months of the year fell 19.6% to $679 million from $845 million the year earlier. Anti-inflammatory drug Remicade sales also fell to $1.1 billion from $1.39 billion from last year.

Two drugs stood out in boosting J&J's results with better-than-expected sales. Anti-inflammatory treatment Stelara revenue increased to $1.41 billion from $1.06 billion, surpassing estimates of $1.36 billion. Multiple myeloma drug Darzalex increased to $629 million from $432 in the same time last year. Analysts had expected $627.7 million.

Consumer sales, which includes Aveeno lotions and over-the-counter drugs like Tylenol, dipped to $3.32 billion from $3.4 billion last year. They fell short of StreetAccount estimates of $3.41 billion. Medical device sales decreased to $6.46 billion from $6.77 billion in the year-earlier quarter, though they came in better than the $6.34 billion analysts had expected.

A Reuters report in December claimed J&J knew for decades its talc baby powder contained asbestos, tanking the company's usually stable stock. J&J has repeatedly denied any wrongdoing and stands behind its namesake baby powder.

The concerns threaten J&J's namesake baby care brand, which J&J relaunched last spring. In the first quarter, baby care revenue fell to $394 million from $457 million last year.

J&J's Spravato, a ketamine-like drug for treatment-resistant depression, won Food and Drug Administration approval in March. Since then, up to 800 treatment centers have been certified to administer the drug and the first patients have been dosed, Jennifer Taubert, executive vice president of pharmaceuticals told analysts.