Melanoma detected early as a mole on the skin can be surgically removed. But once it has metastasized, or spread, it is very difficult to treat, and various drugs have failed in clinical trials.

The last drug approved was interleukin-2 in 1998, but it is so toxic it is rarely used. Neither it nor the other approved drug, dacarbazine, has clearly demonstrated improved survival.

But another drug, being developed by Roche and Plexxikon, has also recently been found to prolong lives of patients with metastatic melanoma in a large clinical trial, according to those companies. They have not provided details of the results but said they hoped to apply later this year for its approval.

Shares of Bristol-Myers rose 86 cents to $27.29, in part because the price of the drug is higher than many analysts had expected and also because the approval allows for wider use of the drug than was predicted.

The company’s trial tested the drug in patients who had already failed to benefit from treatment with another drug. But the F.D.A.’s approval also allows Yervoy to be used for previously untreated patients with metastatic melanoma. Bristol had announced on Monday that a new study showed Yervoy also improved survival when used for previously untreated patients.

Robert Hazlett, an analyst at BMO Capital Markets, said annual sales could eventually exceed $1 billion. Bristol needs sales from new products to help offset the loss of patent protection next year on Plavix, its huge-selling anticlotting drug.

Yervoy is an example of an emerging class of treatments known as immunotherapy that harness the body’s own immune system to fight tumors.