Samsung said its key mobile division enjoyed "substantial earnings improvement" led by expanded sales of its high-end Galaxy S7 and S7 Edge phones

Solid sales of its flagship smartphone and an aggressive cost-cutting drive saw Samsung Electronics on Thursday post a better-than-expected gain in net profit for the second quarter.

The giant South Korean conglomerate said its key mobile division enjoyed "substantial earnings improvement" in the April-June period led by expanded sales of its high-end Galaxy S7 and S7 Edge phones.

Industry trackers estimate that the world's largest smartphone maker has sold about 26 million units of the S7 since it hit stores in March ahead of launches by competitors, including arch-rival Apple.

The mobile division accounts for the lion's share of Samsung's business, but it has been increasingly squeezed by competition both from Apple's iPhone and by lower-end devices from Chinese rivals such as Huawei.

Samsung's overall for the second quarter stood at 5.85 trillion won ($5.2 billion), up 1.7 percent from the previous year and slightly above analyst estimates.

Marketing costs down

Operating profit was up nearly 18 percent at 8.1 trillion won, Samsung said in an earnings statement, reflecting a sizeable cut in mobile marketing costs—partly due to the underwhelming performance of the iPhone.

The Samsung earnings came two days after Apple announced a 27 percent second quarter profit slump on a sharp drop in sales of its iconic handset.

Television and component sales were also strong in the April-June period, Samsung said, with increased profits among premium product ranges.

"Looking ahead to the second half of 2016, the company expects its solid performance to continue... mainly driven by earnings increase in the component business due to sales growth in high value-added products," the statement said.

It also flagged a likely rise in mobile division marketing costs with the launch of its latest outsized Galaxy Note smartphone next week.

The Note series has never had as much of a sales impact as the S-series smartphone, and there will be increased competition with a new iPhone set for release later in the year.

Currency concerns

Greg Roh, an analyst at HMC Investment, said a steady strengthening of the South Korean currency could also eat into profit margins.

"It will be harder for Samsung in the third quarter because of the stronger won and an increase in marketing costs," Roh said.

"The key point will be whether components—like semiconductors—will be able to make up for the loss in profits from finished products," he added.

Sustained profit gains from the company's cheaper smartphones, such as the J series, also helped to boost Samsung's mobile earnings in the second quarter.

Operating profit at the mobile unit rose to 4.32 trillion won from 2.76 trillion won a year ago.

Operating income at the semiconductor unit was 2.64 trillion won, compared with 3.40 trillion won a year earlier, as weaker demand pressured component prices.

The chip unit had helped buttress Samsung's margins when the mobile business went into a protracted slump from late 2014.

The world's number-two chipmaker has dominated production of faster, larger-capacity chips using a technology called 3D NAND.

Samsung was the first to mass produce chips using the technology and is producing the high-margin chips—used in mobile gadgets and hard drives for servers—at its factories at home and in China.