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.
News of the impending deal was reported Sunday.
The deal 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 traded up 20% to $80.47 in early trading as Pfizer shares fell 5 cents to $34.92.
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.
If the deal isn't completed, Medivation could pay Pfizer a $510 million termination fee, according to a regulatory filing.
Pfizer has been seeking to expand its lineup of such oncology treatments. Xtandi would give the New York drug company a beachhead in prostate cancer complementing its breast-cancer treatment Ibrance, which is on track to be a blockbuster.
Medivation's drugs in development could also complement Pfizer's efforts to develop combinations of cancer agents with so-called immunotherapies, which deploy the immune system in the fight against cancer.
The acquisition would also further Pfizer CEO Ian Read's efforts to bolster what he refers to as the innovative side of the company's business. He said on a call with analysts Monday that the move "accelerates our strategy in line with our priorities."
The deal is expected to close in the third or fourth quarter of 2016 and is subject to customary closing conditions and U.S. antitrust clearance.
Pfizer agreed to take over Allergan PLC late last year in a $150 billion deal, but the two companies parted ways in April after the Obama administration targeted the proposed combination with new rules.
Mr. Read has said Pfizer would decide by year's end whether to split into two, with one company selling fast-growing brand-name drugs like Ibrance and another selling drugs that have lost patent protection -- a move that has often been discussed in recent years.
Financial Chief Frank D'Amelio said Monday that the Medivation deal "will not impact the timing of any decision" to break up the company.
Some analysts have said Pfizer needs to do more deals to add patent-protected drugs if that side of the company was to develop the critical mass of revenue it would need to function on its own.
Cancer is one of the pharmaceutical industry's biggest markets with world-wide sales amounting to roughly $80 billion a year and growing more than 10% annually, according to EvaluatePharma.
Despite charging high prices often surpassing $100,000 a year per patient, companies haven't faced the challenges securing reimbursement that have limited sales of new drugs for other diseases.
Medivation is one of the few independent biotechs left with a cancer treatment that is already approved and selling well. CEO David Hung says he decided to found the company after watching a 28-year-old breast-cancer patient die during his oncology fellowship.
Xtandi has held its own against a rival prostate-cancer treatment from Johnson & Johnson called Zytiga. Xtandi, which Astellas Pharma Inc. also sells, could be one of the top-selling cancer drugs by 2020, according to EvaluateSHYPharma.
But J&J is developing a new prostate-cancer drug that could pose a threat to Xtandi, according to analysts.
Medivation was put in play after French drug company Sanofi SA made an unsolicited proposal of $52.50 a share in cash, which the biotech rejected in April, saying the offer substantially undervalued the company. Medivation shares were trading as low as $26.41 in February.
Following Sanofi's proposal, a bidding war resulted. With Pfizer's deal, Medivation is fetching more than double the $6 billion it was valued earlier in the year.
On Monday, Sanofi said that while it saw benefits to a potential deal with Medivation, "we are first and foremost a disciplined acquirer and remain committed to acting in the best interests of Sanofi shareholders."
Austen Hufford and Noemie Bisserbe contributed to this article
Write to Jonathan D. Rockoff at Jonathan.Rockoff@wsj.com