LONDON (Reuters) - GlaxoSmithKline (>> GlaxoSmithKline plc) reported better-than-expected earnings on Wednesday, helped by strong demand for HIV drugs and flu vaccines, which offset a further slide in sales of respiratory medicine, sending its shares 3 percent higher.

Profits were also boosted by tight cost control, resulting in what Bernstein analyst Tim Anderson described as "the first green shoots of margin recovery".

Third quarter sales, in sterling terms, rose 9 percent to 6.13 billion pounds, although profits were still down, reflecting a short-term hit after GSK's recently completed $20 billion asset swap with Novartis (>> Novartis AG).

Core earnings per share (EPS), which exclude certain items, fell 18 percent at 23.0 pence. Analysts on average had forecast EPS of 19.3p and sales of 6.08 billion pounds, according to Thomson Reuters.

Shares in Britain's biggest drugmaker has underperformed the European drugs sector by nearly 40 percent in the past five years, following past profit disappointments and a damaging corruption scandal in China.

But Chief Executive Andrew Witty said the Novartis swap, which has raised exposure to consumer healthcare at the expense of pharmaceuticals, was now benefiting sales and earnings, keeping GSK on track for a return to earnings growth in 2016.

The consumer portfolio includes over-the-counter remedies such as allergy nasal spray Flonase, which was recently switched from a prescription-only product, as well as painkillers and toothpaste.

The consumer business has significantly lower profitability than prescription drugs, although there was a notable improvement in the latest quarter, with margins rising to 13.3 percent from 7.2 percent in the preceding three months.

Among pharmaceuticals, new HIV drugs Tivicay and Triumeq grew strongly, while flu vaccines benefited from higher U.S. demand and a shift to four-in-one shots.

But GSK's mainstay lung drug business was weak, due to pricing pressure on its ageing Advair inhaler in the United States and generic competition in Europe.

New inhalers Breo and Anoro have so far failed to make up the difference and a recent disappointing clinical trial with Breo has not helped.

GSK hopes its respiratory franchise will get a boost from Nucala, a new injection for severe asthma, which could win U.S. regulatory approval by Nov. 4 and Witty told reporters he continued to expect lung drug sales to return to growth in 2016.

Nucala is one of several drugs GSK will highlight at a presentation about its research and development on Nov. 3, the first such briefing in a decade. It also has high hopes for a new shingles vaccine.

Witty said the event would show off a pipeline of new drugs and vaccines "which we believe has significant potential to drive long-term performance".

(Editing by Louise Ireland)

By Ben Hirschler

Stocks treated in this article : Novartis AG, GlaxoSmithKline plc