Icelandair Group Hf reached a surprise agreement to buy discount rival Wow Air, bringing together the island nation’s two financially embattled airlines.

The carriers will continue to operate under separate brands while aiming to better compete on routes linking Europe with North America, they said Monday. Shares of Icelandair surged on the deal, which will ease financial pressure on both airlines while creating a combined company with about 3.8 percent of the trans-Atlantic market.

Both airlines have struggled with slumping tourist visits to Iceland, higher oil prices and the introduction of direct low-cost trans-Atlantic flights by rivals, which have made changing planes en route less appealing. Icelandair, which dates to the 1930s, said last week it had breached debt covenants and asked bondholders to grant a waiver. Unprofitable Wow, founded in 2011, had targeted a listing while seeking a partner to see it through the winter slump.

Icelandair Chief Executive Officer Bogi Nils Bogason said in a statement that he sees “many opportunities for synergies” between the carriers, while Wow’s CEO and founder Skuli Mogensen said his company has been “a pioneer” in low-cost flights across the North Atlantic.

Icelandair shares advanced 51 percent to 11.90 krona. Wow investors, primarily sole owner Mogensen, will get a 5.4 percent stake in Icelandair, which has a market value of 59 billion krona ($490 million) after Monday’s gains. That suggests a valuation of about $26 million for Wow.

Wow’s equity will account for about 3.5 percent of Icelandair, a figure that could fluctuate between 4.8 percent and zero depending on conditions that weren’t detailed. A subordinated loan will be converted to about 1.8 percent of the equity in the buyer, the remainder of the purchase price.

Backpackers’ Favorite

Icelandair developed a reputation as a “backpackers’ airline” in the 1970s, when direct trans-Atlantic trips were focused on the business market and cost far more than they do today.

More recently, the carrier has sought to link cities on either side of the Atlantic that don’t have direct flights, through its Keflavik hub. That market is now being eroded as major operators such as British Airways expand their networks and newer discounters led by Norwegian Air Shuttle ASA launch routes with more efficient planes.

Wow Air also serves the trans-Atlantic market but has tended to focus on major destinations, relying on its low-cost structure to attract cost conscious, time-rich travelers.

With that edge disappearing and vacation visits to Iceland also stagnating after a tourism boom, Mogensen has more recently turned to the U.S.-Asia market for expansion. Flights from North America via Keflavik to New Delhi are due to start on Dec. 7, priced from $199.

Mogensen founded Wow after selling mobile software company Oz Communications to Nokia Oyj in 2008. Icelandic pension funds are among Icelandair’s owners, though its largest shareholder with a 14 percent stake is Lífeyrissjóður Verslunarmanna, which is operated by a retail and office workers’ union.