The takeover creates a communications giant covering fixed-line phones, broadband, mobile and TV. Existing EE shareholders Orange and Deutsche Telekom will sell 100% of their shares.
Deutsche Telecom will hold 12% in the new combined business and have a seat on the board.
Orange will receive a 4% stake, as well as about £3.4bn in cash.
BT says it plans to raise £1bn through a placing of new shares to fund the deal.
It said in a statement: "The combination of EE and BT will provide customers with innovative, seamless services that combine the power of fibre broadband with wi-fi and advanced mobile capabilities.
Savings and revenues
EE leads the market in 4G, the fastest mobile bandwidth. It said on Thursday said its 4G customer base had risen to 7.7 million subscribers.
BT says that within four years, the deal will be saving it £360m a year in terms of operating costs and capital investment.
It added that by combining the two businesses, it should be able to generate an extra £1.6bn a year in sales.
BT chief executive Gavin Patterson said: "This is a major milestone for BT as it will allow us to accelerate our mobility plans and increase our investment in them."
He said the money being spent on the deal did not affect its plans ahead of the multi-billion pound Premier League rights auction, where it is in tough competition with rival Sky.
BT shares rose more than 2.5% on the London market, making the firm the top gainer on the FTSE 100 index.
Consolidation
The mobile phone market is expected to consolidate further. Hutchison Whampoa, which owns rival Three, is said to be in talks to buy O2.
There has been speculation that Virgin may tie up with Vodafone.
And Sky has also announced the launch of its own mobile service, through a deal with O2's network.
The BT-EE deal is expected to be finalised by March next year, subject to approval by shareholders of BT and scrutiny from the Competition and Markets Authority.
COMMENT