SAO PAULO, May 24 (Reuters) - Shares in Brazilian airlines Azul and Gol soared on Friday after they announced a codeshare agreement, connecting their networks and frequent flyer programs in a move that reignited speculation about a potential merger.

The deal covers all domestic routes operated by one carrier but not the other, the companies said in a joint statement. The deal is expected to create some 2,700 travel routes with a single connection.

Azul shares jumped over 10% on the announcement, while shares of Gol rose as much as 19%.

Gol and Azul are respectively Brazil's second and third-largest airlines by revenue passenger kilometer, a gauge of traffic. Each have around 30% of domestic market share, behind LATAM's 40%, according data from regulator ANAC.

Gol has been losing ground since it filed for bankruptcy protection in the United States earlier this year, after struggling with heavy debt and delayed deliveries from planemaker Boeing.

The codeshare agreement comes after media reports that Azul was mulling an acquisition of Gol, which was Brazil's leading airline until 2021.

Azul has said in recent months it was watching the market for potential partnerships, and that it broadly favored consolidation to strengthen carriers.

Analysts at Itau BBA said the codeshare agreement may unlock additional revenue for Azul, while increasing investors' perception of a possible merger.

"Given that Azul flies alone on more than 80% of its routes, combining their businesses could unlock substantial revenue synergies on top of the cost savings for the combined company," the analysts said in a note to clients.

Starting at the end of June, the codeshare agreement does not require antitrust approval.

Brazil's Ports and Airports Minister Silvio Costa Filho said he expects the codeshare agreement between Gol and Azul to expand connectivity and offer more flight options in Brazil.

"The ministry and ANAC will be monitoring any consequences of the agreement, always seeking better services and conditions for the Brazilian consumer," Costa Filho said on social media.

The deal also links Azul and Gol's frequent flyer programs, allowing travelers to earn points in their preferred program.

Azul had a codeshare deal with LATAM in 2020, when the coronavirus pandemic hit the air travel industry, but it fell apart the following year as Azul unsuccessfully bid to combine with the Chile-based carrier.

Local airlines have struggled to stabilize their businesses since the pandemic. Along with Gol's Chapter 11 filing, LATAM came out of bankruptcy court with an $8 billion reorganization plan in 2022. Azul restructured its debt out of court last year.

Analysts at Genial Investimentos said they believe the deal reflects Gol's challenge to keep up with demand at the moment and should benefit Azul with enhanced passenger flow.

Brazilian airlines have seen stronger demand this year, leading Azul to raise in March its estimate for core earnings. (Reporting by Gabriel Araujo Additional reporting by Paula Arend Laier Editing by Brad Haynes and Diane Craft)