British Airways will use Madrid as an expansion point in the absence of spare runway capacity at Heathrow following its merger with oneworld partner Iberia.
The deal could see BA revive its previous ambitions to become more of a global airline brand, something that growth restrictions at Heathrow have limited.
BA has now inked the deal with its Spanish partner, which should see final approval by shareholders and regulators at the end of the year, when the two carriers will come under the umbrella brand known as the International Airlines Group but retain their own identities.
BA is already eyeing expansion possibilities at Madrid's Barajas airport in the absence of confirmation of the third runway at Heathrow.
A BA spokeswoman said: "Work is continuing on a business plan.
"Our networks are complementary, Iberia is very strong in Latin America and we are very strong in North America and Asia and Barajas has four runways and quite a bit of spare capacity compared to Heathrow."
The deal is likely to see the airlines share frequencies on some routes. United Airlines already has a similar arrangement with Aer Lingus on the Madrid-Washington route.
The merger has two potential hurdles to overcome, but neither is seen as big obstacles. The deal must be approved by the European Union, but this has previously given the green light to the merger of Air France and KLM and to a rash of takeovers by Lufthansa.
Another thing in its favour is that Iberia and BA have operated a joint venture on the London-Madrid route for the past seven years, which has allowed them to coordinate schedules and share profits.
"We are not anticipating significant regulatory issues," said BA's spokeswoman.
The second hurdle is that Iberia does have the right to pull out of the deal if BA's £3.7 billion pension deficit proves too much of a deterrent. However, BA is well on the way to remedying this. It has agreed changes to benefits with unions that mean it will retain its final salary scheme but will not inject any more cash into the fund.
Once complete, BA/Iberia will have 408 aircraft and carry more than 58 million passengers to 200 destinations.
A question mark, however, hangs over jobs. BA will remain at its Waterside headquarters, although the International Airlines Group board will meet in Madrid. BA estimates that savings of €400 million a year will be accrued within the fifth year of the merger, but is unable to specify what this will mean for staff.
BA's spokeswoman would only say that the merger "will mean good news for our employees."