Johnson & Johnson topped Wall Street's first-quarter earnings and revenue expectations, fueled by strong pharmaceutical growth.

Sales of some of its drugs boomed, offsetting weaknesses for some of its treatments that are facing competitive pressure. Vision care sales, including contacts and surgical products, helped its medical device business. J&J's consumer division sales grew, but baby care continued to drag on results ahead of a planned relaunch later this year.

Shares of J&J fell nearly 1 percent after rising about 1 percent in premarket trade.

Here's how the company did compared with what Wall Street analysts polled by Thomson Reuters expected:

– Earnings: $2.06 per share vs. $2.02 per share expected.

– Revenue: $20 billion vs. $19.46 billion expected.

J&J reported net income of $4.4 billion, or $1.60 per share, in the first quarter. After stripping out amortization expenses and special items, the company earned $5.6 billion, or $2.06 per share, beating analyst estimates of $2.02 per share.

In the quarter, J&J's revenue increased about 13 percent to $20.01 billion from $17.77 billion a year earlier.

On an operational basis, J&J's revenue grew 8.4 percent. Excluding the impact of acquisitions, divestitures and currency, worldwide sales were up 4.3 percent.

"We had a very strong quarter. We carried our momentum from 2017 into 2018, and our pharmaceutical business continued to have stellar results," Chief Financial Officer Dominic Caruso told CNBC's Meg Tirrell on "Squawk Box."

J&J boosted its full-year sales estimate to between $81 billion and $81.8 billion, up from $80.6 billion and $81.4 billion, reflecting operational growth of 4 percent to 5 percent. Without the effects of acquisitions and divestitures, J&J projects growth between 3 and 4 percent, up from a previously given range of 2.5 percent and 3.5 percent.

The company reiterated its adjusted earnings forecast to between $8 and $8.20 per share, reflecting operational growth between 6.8 percent and 9.6 percent.

The pharmaceutical business posted $9.84 billion in revenue, a 15 percent year-over-year operational increase that topped expectations of $9.46 billion, according to consensus estimates from StreetAccount. Excluding the net impact of acquisitions and divestitures, worldwide sales increased 7.5 percent.

Sales of Zytiga, a prostate cancer drug, surged to $845 million, or 54 percent year-over-year when excluding currency. Analysts had expected revenue to reach $733 million, according to StreetAccount.

Excluding currency, Imbruvica's revenue grew 35 percent to hit $587 million worldwide, topping StreetAccount's estimates of $579.7 million. Darzalex revenue rocketed 64 percent, excluding currency, to reach $432 million in worldwide sales, surpassing estimates of $395.7 million.

Blood thinner Xarelto's sales grew about 13 percent on an operational basis to reach $578 million in global sales, falling short of analysts' estimates of $633.7 million.

Rheumatoid arthritis drug Remicade has been under pressure from biosimilars, or generic versions of biologic drugs. Worldwide sales slid 18 percent, excluding a positive currency impact, to $1.34 billion. Analysts had been expecting sales of $1.5 billion, according to StreetAccount.

In February, the Food and Drug Administration approved Erleada, or apalutamide, to treat nonmetastatic castration-resistant prostate cancer.

J&J's medical device unit grew 3 percent on an operational basis from last year, reaching $6.77 billion and topping Street estimates of $6.68 billion. Excluding the net impact of acquisitions and divestitures, worldwide sales increased 1.1 percent.

J&J has been pruning its medical device portfolio. Last month, J&J said it received a $2.1 billion bid for its LifeScan diabetes business from private-equity firm Platinum Equity.

On a call with analysts Tuesday, Caruso said the vision portfolio is doing "exceptionally well." He also pointed to the electrophysiology and endocutter units as bright spots in the medical device group.

"And so having said that, we do have areas where we need to improve, and we'll improve in those areas through a number of factors as we've always done it at Johnson & Johnson over the years: A good mix of internal innovation and acquisitions and new technologies. I don't think that's ever been an issue for us. We've always been able to do that," Caruso said.

The company's consumer segment generated $3.4 billion in the quarter, up 1.3 percent from the year-ago quarter and better than the $3.33 billion analysts had expected. Excluding the net impact of acquisitions and divestitures, worldwide sales grew 2 percent.

J&J's consumer business has struggled along with other incumbents in the space. Baby care sales dipped to $457 million from $455 million, or nearly 3 percent year-over-year when excluding currency. J&J is expected to relaunch the line later this year.

In wake of the new tax law, the company plans to invest more than $30 billion in research and development and capital investments in the U.S. over the next four years, an increase of 15 percent.

Caruso said the new law provides more flexibility to use J&J's capital, including to create new ways to improve health care and manufacture new technologies in the U.S.

"We're very proud we're able to do that, especially in the U.S.," he said.