AT&T said on Monday it would buy Straight Path Communications, a holder of licenses to wireless spectrum, for $1.25 billion in an all-stock deal as it aims to accumulate the airwaves it needs for a next generation network.

The deal shows how wireless carriers may be increasingly willing to pay lofty prices for assets that they view as critical to 5G, which is expected to boast higher speeds and more capacity.

The network is widely considered to be a multibillion-dollar opportunity, and wireless carriers do not have many options in terms of acquisition targets that would give them the right type of spectrum for a next generation network. Straight Path is one of the largest holders of 28 GHz and 39 GHz millimeter wave spectrum used in mobile communications.

The No.2 U.S. wireless carrier said it would offer $95.63 per share, a premium of 162.1 percent to Straight Path's close on Friday.

Straight Path's shares leaped 150 percent to near $91 a share in afternoon trade, while AT&T's shares were marginally lower.

Millimeter wave spectrum is expected to play a large role in 5G. Earlier this year, AT&T said it was acquiring privately held FiberTower and its millimeter wave spectrum rights. In February, competitor Verizon Communications, the No. 1 U.S. wireless carrier, said it had closed on its acquisition of XO Communications' fiber-optic network business for about $1.8 billion, giving it access to millimeter wave spectrum.

Between FiberTower and Straight Path, AT&T should have a similar amount of spectrum as Verizon if not more, said Wells Fargo analyst Jennifer Fritzsche, in a note on Monday.

Other companies in the industry rose after the news as investors are expecting a wave of mergers and acquisitions in telecom this year. Sprint earlier rose 1.5 percent to $8.49, while Dish Network rose 2.3 percent to $64.01.

Straight Path had said in January it was hiring investment bank Evercore Partners to help explore strategic alternatives, including a sale of assets.

The company had also agreed in January to pay the U.S. Federal Communications Commission (FCC) $15 million to settle a federal probe of claims that Straight Path had submitted false data to renew airwave licenses.

The tax-free deal, valued at $1.6 billion in total, includes liabilities and amounts to be remitted to the FCC, according to the January settlement terms.

The deal with AT&T is supported by Straight Path's majority shareholder, Howard Jonas, who has entered into a voting agreement with the carrier in support of the transaction.

Evercore advised Straight Path on the deal and Weil, Gotshal & Manges provided legal counsel, while AT&T was advised by Moelis & Co. and Kilpatrick Townsend & Stockton.

— CNBC contributed to this report.