Sirius XM will buy music streamer Pandora Media Inc for $3.5 billion, as it seeks to build scale to battle heavyweight streaming rivals Spotify and Apple Music.

Sirius XM, controlled by media mogul John Malone’s Liberty Media Corp, has built a name supplying more than 175 channels to car drivers, but has largely trailed Pandora and Spotify Technology SA in mobile and streaming content.

Monday's deal gives the pair a market value of about $34 billion, topping Spotify's $31.2 billion and follows through on Sirius' purchase of a 15 percent preferred-stock stake in Pandora for $480 million last year.

Shares in Pandora, which has posted losses for at least the past eight quarters, initially soared 18.4 percent to $10.75 in premarket trading, topping an offer value of $10.05 based on Sirius' Friday closing price.

Sirius shares, however, fell 5 percent to $6.63 as investors worried the company had overpaid.

The deal, worth $2.68 billion at that offer price, is expected to generate more than $7 billion in expected pro-forma revenue in 2018. Analysts said the two businesses were largely complementary.

"SIRI cannot offer on-demand radio, and cannot offer customization, and Pandora offers both," said Michael Pachter, an analyst with Wedbush Securities in Los Angeles.

"Sirius can merge Pandora’s radio business into its satellite subscription business, and can also begin to offer on-demand to its large installed base of satellite subscribers."

Pandora shareholders will receive a fixed-exchange ratio of 1.44 newly-issued SiriusXM shares for each share they hold.

The transaction is expected to close in the first quarter of 2019.

Allen & Co LLC and BofA Merrill Lynch are financial advisers to SiriusXM and Baker Botts LLP and Simpson Thacher & Bartlett LLP are providing legal counsel.

Centerview Partners LLC, LionTree Advisors LLC and Morgan Stanley & Co LLC are financial advisers to Pandora and Sidley Austin LLP is the legal counsel.