BA has been considering a merger with Iberia for some time
British Airways and Spanish airline Iberia say they have reached a preliminary agreement for a merger expected to be completed in late 2010.
The merger, which must be approved by the European Commission, would create the world's third biggest airline.
Under its terms, Iberia would take a 45% stake and BA, which last week reported a six-month pre-tax loss of £292m, a 55% stake in the company.
Iberia says it can pull out if BA fails to resolve its pension deficit problem.
"The merger will create a strong European airline well able to compete in the 21st Century," said BA chief executive Willie Walsh.
"Both airlines will retain their brands and heritage while achieving significant synergies as a combined force."
The two airlines had been discussing the deal at separate board meetings.
It would create an airline with 419 aircraft flying to 205 separate destinations, and would save the two partners 400m euros ($594m; £358m) in costs a year, they said.
Iberia's chairman Antonio Vazquez would take the same role at the new company, while Mr Walsh would become its chief executive.
News of the deal did not go down well with Virgin Atlantic, one of BA's big competitors in the UK, which raised concerns about the new company's market share.
"The merger will increase BA's dominance at Heathrow with 44% of take-off and landing slots this winter. It is impossible for any other airline to replicate their scale," the airline said.
Both BA and Iberia have been losing money during the downturn as businesses and individuals cut back on flying.
Mr Walsh has previously said a merger would help both firms cope with the recession.
Iberia staff are due to strike over pay in the run-up to Christmas
The firms have considered a tie-up for a number of years and held talks on the issue in July 2008.
BA already owns 13.5% of Iberia and the two carriers have a code-sharing agreement under the One World grouping of airlines, which allows them to sell seats on each other's services.
If a merger is formalised, it would still require regulatory approval from the European Commission.
However, analysts say a deal is likely to be cleared, pointing to Air France's successful merger with Dutch airline KLM in 2004.
The agreement comes a week after BA said it would cut a further 1,200 jobs, as it reported a first-half loss for the first time.
HAVE YOUR SAY
We are in a recession and the member states of the EU must pull together for the good of all
James, East Lothian
It made a pre-tax loss of £292m in the six months to the end of September.
The half-year results also revealed a growing problem with its two final-salary pension schemes.
In the past six months, the surplus in one scheme fell from £860m to £27m, while the deficit in the other scheme ballooned from £1.2bn to £2.7bn.
Iberia's most recent results showed that it made a loss of 72.8m euros between April and June.
Both airlines are also negotiating with staff over strike action.
BA cabin crew are being balloted on whether to take action over the company's cost-cutting plans, while Iberia staff have already gone on strike over pay, and plan more disruptions in the run-up to Christmas.