Brazilian airline Azul (AZUL -0.78%) has sealed an alliance with rival Gol Linhas Aereas Inteligentes that could lead to an eventual merger.

Investors are optimistic the agreement will help the industry gain pricing power, sending shares of Azul up by as much as 11% in early trading. As of 2:20 p.m. ET, those gains had moderated to about 5%.

The start of a merger process?

Azul has been one of the top airlines in Latin America since the pandemic, but it has not been an easy journey. The local air travel industry has not seen the same post-pandemic demand surge that North American carriers have enjoyed. Shares of Azul today trade about 80% below where they were at the beginning of 2020.

Azul and Gol took a step toward easing the pressure when they announced a commercial cooperation agreement that connects their operations in Brazil via codesharing. The partnership covers all domestic routes operated by one, but not both, of the airlines.

They will also combine their frequent flier programs.

The codeshare deal could be a precursor to a more all-encompassing combination. Bloomberg, citing unnamed sources, reported that the alliance was "the first step" toward the two airlines merging.

Is Azul a buy following its alliance news?

Gol is operating out of bankruptcy, and an outright merger of the two carriers would be complex. But according to the Bloomberg article, Azul is engaged in conversations with creditors and shareholders of the two airlines in hopes of reaching a broader deal.

The codeshare is progress, but a merger would really help Azul. With the codeshare, Azul can grow its domestic network without the cost of adding new airplanes and flight crews. The merged frequent flier program could also attract new business from customers who were previously loyal to Gol.

A merger would offer greater benefits, including the ability to cut capacity on overlapping routes and consolidate back-office expenses.

Investors should be encouraged by this development, but Azul will have to go a step further for the stock to really fly higher from here.