AT&T Inc. said Sunday it will buy T-Mobile USA from Deutsche Telekom AG in a cash-and-stock deal valued at $39 billion US, becoming the largest cellphone company in the U.S.

The deal would reduce the number of wireless carriers with national coverage from four to three, and is sure to face close regulatory scrutiny. It also removes a potential partner for Sprint Nextel Corp., the struggling No. 3 carrier, which had reportedly been in talks to combine with T-Mobile USA.

AT&T will pay about $25 billion in cash and the balance in company stock in a deal that gives Deutsche Telekom, Germany's largest phone company, about an 8 percent equity stake in AT&T. Deutsche Telekom will get one seat on AT&T's board.

Like Sprint, T-Mobile has been struggling to compete with much larger rivals AT&T and Verizon Wireless, and its revenue has been largely flat for three years. Bellevue, Wash.-based T-Mobile USA's subscriber count has stalled at just under 34 million, though it posts consistent profits.

There have been reports over the last year that Deutsche Telekom has been looking at radical moves to let it get more value out of its U.S. holding, including a possible combination with a U.S. partner.

AT&T to have 129 million subscribers

With the acquisition, AT&T would vault past Verizon Wireless as the largest U.S. cellphone company, with 129 million subscribers. AT&T is now the country's second-largest wireless carrier and T-Mobile USA is the fourth largest.

To assuage regulatory concerns, AT&T said in a statement Sunday that it will spend more to expand ultrafast wireless broadband into rural areas. It also said the deal will improve network quality for the customers of both companies and increase the number of cell towers by about 30 percent in some of its most populated areas, while avoiding construction of additional towers.

The deal has been approved by the boards of both companies. Dallas-based AT&T can increase its cash portion by up to $4.2 billion, with a reduction in the stock component, as long as Deutsche Telekom receives at least a 5 percent equity ownership interest in the buyer.

AT&T will finance the cash part of the deal with new debt and cash on its balance sheet and will assume no debt from T-Mobile.