A.P. Moeller Maersk A/S shares gained as Denmark’s biggest company met punishing market conditions with cost cuts in order to create a leaner business. The company’s B-shares rose as much as 6.9 percent after the market opened on Friday, and traded 5 percent higher at 9,520 kroner as of 9:34 a.m. in Copenhagen. Maersk reported an 88 percent drop in second-quarter profit as its oil and container divisions both suffered from falling prices, but earnings before interest and tax came in at $656 million, beating an estimate of analysts surveyed by Bloomberg of $551 million. The company lost money in its shipping division, Maersk Line, but said that unit costs per 40-foot container fell to $1,911 in the quarter from $2,246 a year earlier. Signs of greater efficiency show the company is likely to perform better in coming quarters, according to analysts. Despite the loss, Maersk Line gained market share and “efficiency beat expectations,” Christopher G. Combe, an analyst at JPMorgan, said in a note. He’s advising clients to buy Maersk shares on an assumption that results will improve next quarter. “We continue to place disproportionate weight on the Maersk Line result,” Combe said. “While a disappointment, market share gains and efficiency exceeded expectations while rates drove the miss. Combined with signs of improving rates in the third quarter and supportive utilization levels, we remain bullish.” The Maersk Line result was “very encouraging as volumes gained 6.9 percent,” according to Frode Moerkedal, an analyst at Clarksons. The company’s underlying result fell to $134 million at the group level, from $1.1 billion a year earlier, it said in a statement on Friday. That missed the average estimate of $239 million in a Bloomberg survey of analysts. “The result is unsatisfactory,” Chief Executive Officer Soren Skou said in a statement. “Cost reductions and operational optimizations, however, made a significant contribution to mitigating the impact of the negative market conditions.” Maersk’s energy exploration unit has suffered from a plunge in oil prices of about 60 percent since a June 2014 peak. With the continued burden of falling freight rates pummeling Maersk’s shipping business, the company is now exploring its strategic options and may spin off some units. The company on June 23 fired CEO Nils Smedegaard Andersen, replacing him with Skou, the CEO of Maersk Line. The board will report on the progress of the strategic review before the end of the third quarter, it said on Friday. Maersk also said it will need to postpone a capital markets day that had been planned to take place on Sept. 22. Maersk said it now sees a positive result in its oil unit, in part due to lower exploration costs, after having previously guided it would just break even. Still, it also warned that the unit will only make money if the price of oil exceeds $40-45 a barrel. Brent crude traded at about $46 on Friday. The company kept its forecast for an underlying result at the group level that will be “significantly below” last year’s, which was $3.1 billion.