Pfizer Inc. said Monday that it had agreed to buy biotech Medivation Inc. for about $14 billion, in a move that adds one of the crown jewels of the multibillion-dollar market for cancer drugs to Pfizer’s portfolio.

The agreement ends months of bidding for San Francisco’s Medivation, one of the most desired independent biotechs because it sells a leading prostate-cancer drug.

Pfizer will pay $81.50 a share, a 21% premium to Medivation’s closing stock price Friday. Medivation shares moved up nearly 20% to $80.41 in trading on Monday in New York, as Pfizer shares fell 5 cents to $34.86.

Medivation’s drug, Xtandi, already generates about $2 billion in yearly sales and has the potential to more than double, according to analysts.

Pfizer said the deal would add 5 cents to earnings in the first full year after closing and isn’t expected to affect its 2016 financial guidance. Pfizer said it plans to finance the transaction with its cash holdings.