Biologic drugmaker Amgen said Tuesday that it will lay off 12 to 15 percent of its worldwide workforce and close four sites, even as it reported stellar second-quarter results that trounced Wall Street expectations.

Amgen also raised its forecasts for its 2014 profit and revenue, driving up its shares.

The maker of Prolia for osteoporosis and anemia treatment Aranesp said it's restructuring to free up money needed for investments in the business, particularly marketing and other costs for launching new drugs.

"We began this action with strong confidence in the underlying performance of our business," CEO Bob Bradway told analysts on a conference call.

The layoffs will happen this year and next, eliminating 2,400 to 2,900 of its 20,000 jobs, mostly in the U.S. Amgen plans to close two sites in Washington state that focus on research and development and two in Colorado, primarily manufacturing plants with 20-year-old technology. It's investing in the latest technology elsewhere.

Amgen said it will streamline the company, reduce management layers and reduce its real estate footprint by 23 percent. It will keep its headquarters in Thousand Oaks, California, albeit with a smaller staff.

The company anticipates charges of $775 million to $950 million for site closures and severance payments, mostly in 2014 and 2015. It expects modest 2015 savings, but expense reductions in 2016 of about $700 million, versus 2013 spending. Most savings will be reinvested, including expanding its operations in the biotech hubs of Cambridge, Massachusetts, and South San Francisco, California.

"We have an unprecedented number of late-stage programs rolling through at the moment," said research head Sean Harper.

Amgen is awaiting U.S. approval for its chronic heart failure medicine, ivabradine, and its advanced melanoma drug, talimogene laherparepvec. The company hasn't announced brand names for either one.

It plans to apply in this quarter for U.S. and EU approval of evolocumab, for abnormal levels of blood fats such as cholesterol. It's targeting the second half of the year to apply for U.S. approval of blinatumomab, for acute lymphoblastic leukemia that's relapsed or not responded to prior treatment. And it's conducting late-stage patient tests on drugs for psoriasis, recurrent ovarian cancer and a thyroid disorder.

Meanwhile, Amgen posted a 23 percent jump in second-quarter profit as revenue jumped 11 percent on strong performances by nearly all of its drugs.

Net income was $1.55 billion, or $2.01 per share, up from $1.26 billion, or $1.65 per share, in 2013's second quarter.

Excluding one-time charges, adjusted income was $1.82 billion, or $2.37 per share. Analysts expected just $2.07 per share, according to FactSet.

Revenue totaled $5.18 billion, up from $4.68 billion a year earlier. Analysts were expecting $4.92 billion.

Among its top sellers, sales of anemia drugs Neulasta and Neupogen slid 1 percent to $1.1 billion, but Enbrel for rheumatoid arthritis and other immune disorders saw sales climb 7 percent to $1.2 billion.

Amgen said it now expects adjusted earnings per share of $8.20 to $8.40 per share, up from its January forecast of $7.90 to $8.20. And it's anticipating revenue of $19.5 billion to $19.7 billion, up from $19.2 billion to $19.6 billion. It also expects a low tax rate, 15 percent to 16 percent for the full year.

"We view the restructuring plan and 15 percent workforce reduction announced as a positive that will help the company improve its cost structure while continuing to invest in the pipeline and key product launches," Citigroup analyst Dr. Yaron Werber wrote to investors.