Johnson & Johnson posted a 5 percent drop in second-quarter earnings on Tuesday, but profit and revenue beat analysts' forecasts thanks to surprisingly resilient pharmaceutical and consumer product sales.

Revenue took a hit from patent expirations on its drugs for schizophrenia and epilepsy, but sales of its blockbuster arthritis drug Remicade were better than expected. Analysts also cited the ability of the giant diversified healthcare company, shares of which rose slightly, to contain costs.

They went through a cost-cutting exercise about a year and a half ago, and it's definitely helping them with their earnings to date, said Jan Wald, an analyst with Noble Financial Group. The surprise is more on the revenue side ... and that bodes well.

The New Brunswick, New Jersey-based company, which makes products ranging from Band-Aids to complex biotechnology medicines, earned $3.21 billion, or $1.15 per share for the second quarter. That compares with $3.37 billion, or $1.18 per share, in the year-earlier period.

Analysts on average had expected $1.11 per share, according to Reuters Estimates.

J&J's quarterly revenue fell 7.4 percent to $15.24 billion, but was $190 million higher than analysts had expected.

Revenue would have been 6 percentage points higher if not for the stronger dollar, which hurts the value of overseas sales. Some analysts had expected a worse toll from currency.

All in all it looks like a positive quarter, especially considering the economic environment, said Damien Conover, an analyst at Morningstar.

The company reaffirmed its full-year profit forecast of $4.45 per share to $4.55 per share, excluding special items, which would be little changed from last year.

Sales of prescription drugs fell 13.3 percent to $5.5 billion, as patients opted for cheaper generic forms of J&J's Risperdal schizophrenia treatment and Topamax, an epilepsy pill that lost U.S. patent protection in recent months.

Topamax sales plunged 73 percent to $182 million, while Risperdal's fell 66 percent to $239 million.

Even so, analysts had been girding for an even bigger decline in the pharmaceuticals business amid the erosion of Risperdal and Topamax sales.

It appears they underestimated how well other pharmaceutical products were doing, J&J Chief Financial Officer Dominic Caruso said in an interview.

Caruso cited demand for Remicade, sales of which jumped 24 percent to $1.1 billion, and cancer treatment Velcade, sales of which rose 12 percent to $229 million.

The pharmaceutical business looked especially strong to us, said Noble's Wald, who noted that declines for Procrit and Eprex -- anemia drugs strapped with safety concerns -- were not as bad as feared.

J&J said it will not provide requested data to U.S. regulators about the delayed blood thinner Xarelto (rivaroxaban) until at least the fourth quarter. J&J is partnered with Germany's Bayer AG on Xarelto, a potential blockbuster.

Global sales of consumer products, including J&J's Aveeno skin care line, fell 4.5 percent to $3.85 billion, but would have risen almost 5 percent if not for the stronger dollar.

Caruso said he could not yet endorse some analyst suggestions that growing demand for J&J's consumer brands indicate the worldwide recession is easing its grip.

It's too early to say that; we'd have a hard time pinpointing when it would turn around, Caruso said.

Sales within the company's other major business -- medical devices and diagnostics -- slipped 3.1 percent to $5.89 billion, hampered by foreign exchange factors.

Growing demand for J&J's surgical and orthopedics products was partly offset by lower sales of stents, tiny devices used to prop open coronary arteries that have been cleared of plaque.

In its DePuy orthopedic business, J&J said pricing pressure from hospitals has increased, and the overall market for reconstructive joints is growing at a slower pace than in past years. Analysts said the results offered no signs that the effects of the economic slowdown on elective surgical procedures are abating.

One potential hurdle for J&J going forward will be the impact of safety concerns over its Tylenol painkiller, said Morningstar's Conover. Last month a U.S. advisory panel called for greater restrictions on acetaminophen products such as Tylenol, citing the potential for acetaminophen to cause liver failure and even death when taken in excessive doses.

J&J shares were up 31 cents or 0.5 percent to $58.03 in afternoon trading on the New York Stock Exchange. (Reporting by Ransdell Pierson and Lewis Krauskopf, additional reporting by Toni Clarke in Boston and Susan Kelly in Chicago; Editing by Gerald E. McCormick and Matt Daily)