EasyJet will enter into leases for up to 25 A320 aircraft and take over slots, it said, as the last Air Berlin flights were set to land back in Germany.
The company also said it was hoping to recruit around 1,000 Air Berlin pilots and cabin crew over the coming months, to be employed on German contracts.
Air Berlin, Germany's second-ranked airline employing some 8,000 people, triggered bankruptcy proceedings in August after its biggest shareholder Etihad Airways pulled the plug on a cash lifeline following years of losses.
EasyJet said the 40-million-euro price it was paying excludes "potential start-up and transitional operating costs", adding: "The acquisition is subject to regulatory approvals and is expected to close in December 2017.
"This agreement is consistent with easyJet's strategy of purposeful investment in strong number one positions in Europe's leading airports (or number two to a legacy incumbent)," the carrier said in a statement.
"This will enable easyJet to operate the leading short haul network at Tegel connecting passengers to and from destinations across Germany and the rest of Europe."
It claimed that in addition to easyJet's existing base at Berlin Schoenefeld, it would make the carrier the "leading airline" in the German capital. Air Berlin was able to keep flying until now thanks to a 150-million-euro ($175 million) bridging loan from the German government, giving it time to negotiate the sale of its assets.
German and international investors and competitors lined up, with an eye not only on Air Berlin's aircraft but also coveted take-off and landing slots at crowded airports.
German flag carrier Lufthansa is taking the biggest chunk, buying 81 of the insolvent airline's 144 aircraft. It also plans to hire up to 3,000 Air Berlin staffers.
EasyJet said it would operate a reduced timetable at Tegel during the European winter but planned to operate a full schedule from summer 2018.
The carrier said it would announce new routes and services to and from Tegel in due course.