Britain's GlaxoSmithKline and Swiss rival Novartis have agreed a multibillion dollar swap of assets in a move that led to a rally in pharmaceutical stocks as investors bet on a renewed burst of dealmaking across the sector.

The two drug companies will join forces in the consumer healthcare sector to combine brands including Aquafresh, Beechams and Tixylix, while exchanging their oncology and vaccine businesses.

The deal comes amid a frenzy of takeover speculation in pharmaceuticals with the US drugs group Pfizer reportedly considering a $100bn (£60bn) bid for Britain's AstraZeneca, while Canadian group Valeant Pharmaceuticals on Tuesday confirmed a $46.5bn move for Allergan, the California-based maker of Botox.

Shares in GSK rose 5.2% to £16.40 and Switzerland's Novartis rose 2% to 76.40 Swiss francs (£51.28). AstraZeneca rose nearly 4.7% and the UK's Shire jumped 4% to £30.60 on hopes of more deals to come, with the FTSE100 index climbing nearly 1%.

GSK shareholders will benefit from a £4bn capital return funded by net proceeds of $7.8bn from the Novartis deal, in which the Brentford-based firm is selling its oncology business to Novartis for $16bn and purchasing its new partner's vaccine business for an initial $5.25bn. A further $1.8bn is promised to Novartis if the vaccines division performs well. Novartis, meanwhile, is selling its animal health division to US pharmaceutical company Eli Lilly for $5.4bn.

Sir Andrew Witty, the GSK chief executive, said the complex deal had taken months to agree but was a step on from the mega-mergers of the past under which firms might gain two or three useful businesses alongside seven or eight unwanted elements which could distract attention from developing its core business. "I believe if you really focus the transaction on just the things you really care about you can create tremendous value in that space," Witty said.

"Opportunities to build greater scale and combine high quality assets in vaccines and consumer healthcare are scarce. With this transaction we will substantially strengthen two of our core businesses and create significant new options to increase value for shareholders," he added.

The combined consumer healthcare business will house 19 brands, including Panadol and Nicotinell, with sales of more than $10bn worldwide in what Witty described as a "powerhouse in over-the-counter products". Witty added that the deal strengthened GSK's global leadership in the vaccines market, increased its scale in consumer health products and would deliver immediate sales and earnings benefits once completed in early 2015. GSK will continue to develop experimental cancer treatments and could market these itself in future, although Novartis will have first refusal if it decides to seek a partnership with a third party.

Savvas Neophytou, an analyst at Panmure Gordon, upgraded GSK to a buy as he said the deal was a sensible move away from "white tablet" pharmaceuticals and the lacklustre oncology business after a tricky few weeks for the company, which has been embroiled in corruption allegations. "Today's transaction shows management will not sit idly by waiting for the pipeline to mature but will take brave decisions to unlock shareholder value," Neophytou wrote in a note.

Tim Anderson, at Bernstein Research, said the acquisition of GSK's cancer division was good news for Novartis. "It is odd to us that GSK would give up this business as oncology is a 'hot' therapeutic area and the company has had some pipeline successes," he said. Drugmakers are stocking up their oncology pipelines as they bet that combinations of drugs or drug cocktails will become the future of cancer care. A desire to boost its oncology business is seen as a key factor behind Pfizer's reported interest in AstraZeneca.

Joseph Jimenez, chief executive of Novartis, said the agreements with GSK marked a "transformational moment for Novartis. They focus the company on leading businesses with innovation power and global scale." He said profits would improve as it brought in the higher margin cancer treatments and sold off less profitable animal health and vaccines units.

The transaction between the two major pharmaceutical companies will meanwhile lead to a cascade of smaller deals.

GSK is to accelerate a review of its historic medicines business – which include drugs such as the antidepressant Seroxat and the prostate cancer drug Avodart – and investors should "not be surprised if we are able to transact a disposal in the next year or two". At the same time, Novartis said it would be seeking a buyer for its flu vaccine business which is not included in the wider vaccines deal with GSK.

While the Novartis-GSK transactions will face scrutiny from competition watchdogs, Witty said he did not expect a "substantial number of issues", because the businesses were "remarkably complementary" both in geographic and product terms.

The company expects to gain £1bn in annual cost savings from the deal. Witty said there would be "minimal impact" to jobs in the UK and that new jobs in research and development could be created as the company expected to reinvest £200m of its savings in new research and development.

Deal details

• The Swiss company Novartis will buy Brentford-based GlaxoSmithKline's oncology arm for up to $16bn (£9.5bn).

• GSK will buy Novartis's vaccines business for up to $7.05bn.

• Both companies will create a consumer healthcare division, which will include well-known brands such as Aquafresh, Beechams and cough mixture Tixylix.

• GSK will return £4bn to shareholders as part of the deal.

• Novartis will sell its animal health arm to Eli Lilly of the US for $5.4bn.