The parent company of Aer Lingus is to buy Spanish carrier Air Europa for €1bn.
International Airlines Group (IAG) and Globalia have signed definitive transaction agreements.
IAG says the move will transform its Madrid hub into a "true rival" to Europe's four largest hubs: Amsterdam, Frankfurt, London and Paris.
The sale is expected to be completed in the second half of 2020, following relevant approvals.
Air Europa operates scheduled domestic and international flights to 69 destinations - including European and long-haul routes to Latin America, the United States of America, the Caribbean and North Africa.
In 2018, the company generated revenue of €2.1bn and an operating profit of €100m.
It carried 11.8 million passengers in 2018 and ended the year with a fleet of 66 aircraft.
This would be IAG's fourth Spanish airline after the flag carrier Iberia, regional airline Vueling and long-haul carrier Level.
Commenting on the sale, IAG CEO Willie Walsh said: "Acquiring Air Europa would add a new competitive, cost effective airline to IAG, consolidating Madrid as a leading European hub and resulting in IAG achieving south Atlantic leadership, therefore generating additional financial value for our shareholders.
"IAG has a strong track record of successful acquisitions, most recently with the acquisition of Aer Lingus in 2015 and we are convinced Air Europa presents a strong strategic fit for the group."
Javier Hidalgo, chief executive of Globalia, added: "For Globalia, the incorporation of Air Europa to IAG implies the strengthening of the company's present and future that will maintain the path followed by Air Europa in the last years.
"We are convinced that the incorporation of Air Europa to a group such as IAG, who over all these years has demonstrated its support to the development of airlines within the group and the Madrid hub, will be a success"
IAG says it plans to integrate Air Europa into the existing Iberia hub structure at Madrid.
It would also creating commercial links between Air Europa and other IAG operating companies - including Aer Lingus.
Air Europa would add reciprocal intra-group code-shares across all connecting gateways and become part of IAG's Avios loyalty programme.