Johnson & Johnson shares climbed about 3% Friday after an Oklahoma judge reduced the penalty the company must pay over the state's opioid lawsuit from $572 million to $465 million.

Immediately after the reduction, the company said it would appeal the decision.

Oklahoma Judge Thad Balkman originally ordered a $572 million penalty in late August, ruling that a Johnson & Johnson subsidiary "caused an opioid crisis that's evidenced by increased rates of addiction, overdose deaths and neonatal abstinence syndrome."

The subsidiary, Janssen, repeatedly downplayed the risks of its drugs and trained sales representatives to tell doctors that the risk of addiction was 2.6% or less, the court said.

Johnson & Johnson also appealed that decision, arguing that there was not a proper legal basis for Oklahoma to file a "public nuisance" claim against the company.

Johnson & Johnson, along with other pharmaceutical companies, face thousands of lawsuits stemming from the nationwide opioid epidemic.

Shares of drugmakers Mallinckrodt, Teva Pharmaceutical and Endo International also rose after news of the latest ruling, jumping more than 4%, 7% and 9%, respectively.

Shares of Johnson & Johnson closed at $134.94, up 3% from where they opened Friday.

The other pharmaceutical companies also rallied into the close: Mallinckrodt finished at $2.91 per share, up 4% for the day; shares of Teva Pharmaceutical closed at $10.20, up nearly 9%, and shares of Endo International closed at $4.53, also up nearly 9%.

— CNBC's Berkeley Lovelace Jr. contributed to this report.

