Johnson & Johnson posted a rare quarterly loss, a whopping $10.71 billion, due to a $13.6 billion charge related to last month's U.S. tax overhaul.

While the loss was expected and the company's adjusted results beat Wall Street expectations, shares fell more than 4 percent, an unusually big swing for the health care giant.

On Tuesday, J&J reported a big jump in sales, but that was offset by sharply higher spending on production, marketing, administration and research, partly due to one-time charges.

The $13.6 billion charge is for a tax payment on years of accumulated foreign earnings, now being brought back to the U.S., that amount to more than $66 billion, Chief Financial Officer Dominic Caruso said in an interview. About $18 billion of that was held in cash and was taxed at 15 percent, while the remainder was taxed at a low 8 percent rate.

Caruso told analysts on a conference call that "$12 billion will come back immediately. We'll immediately use that to fund operations in the U.S."

That will include investing in innovative products and paying shareholder dividends, he said. J&J won't necessarily go on a shopping spree, having made 16 acquisitions totaling $35 billion last year, including its biggest-ever, $30 billion to buy Swiss biopharmaceutical company Actelion to enter the lung blood pressure niche.

"This was a strong quarter for Johnson & Johnson, as the pharmaceutical segment ... continues to drive solid growth for the company," Edward Jones analyst Ashtyn Evans wrote to investors.

Despite that, J&J shares closed down $6.31 at $141.83.

Evans said she was "scratching her head" over the steep drop, adding it could be due to a combination of factors: the size of the net loss, investors expecting a stronger financial forecast for 2018, fears that prostate cancer drug Zytiga might get generic competition late this year even though J&J said it won't, or a federal appeals court ruling invalidating some patients of top seller Remicade, which already has two cheaper competitors.

The maker of biotech drugs and Band-Aids said the fourth-quarter loss amounts to $3.99 per share. A year earlier, the New Brunswick, New Jersey, company had a net profit of $3.81 billion, or $1.38 per share.

Excluding the tax charge and other one-time gains and costs, earnings came to $4.78 billion, or $1.74 per share, topping Wall Street projections by 2 cents.

The world's biggest maker of health care products posted revenue of $20.2 billion, a hair below Street forecasts for $20.22 billion but up 11.5 percent from a year ago.

Sales of prescription drugs, J&J's largest business, jumped 17.6 percent to $9.68 billion, led by a 40 percent jump in sales of cancer drugs, including Darzalex, Imbruvica and Zytiga.

Sales of drugs for immune-system disorders rose 5 percent to $3.1 billion, including recently approved Tremfya for plaque psoriasis. However, revenue from J&J's top-selling medicine, Remicade for rheumatoid arthritis, Crohn's disease and other immune conditions, fell nearly 10 percent due to increasing competition from biosimilars. Those are near-copies of complex biologic drugs "manufactured" inside living cells.

Expenses were higher across the board, with manufacturing costs up 31 percent, marketing and administration spending up 13.5 percent and research and development costs up nearly 38 percent, in addition to a $408 million charge for acquisition of products in development.

Johnson & Johnson said it expects full-year earnings of $8 to $8.20 per share and revenue of $80.6 billion to $81.4 billion.

That beat Street expectations for $7.88 per share and $80.7 billion in sales, and follows two straight quarters of "solid outperformance," Leerink analyst Danielle Antalffy noted. The forecast "highlights management's confidence in continued positive momentum across its businesses," she wrote to investors.

For all of 2017, J&J reported revenue of $76.45 billion and net income of just $1.3 billion, due to the tax charge.