GettyImages-545290282
Visitors test Samsung Electronics' Galaxy S7 edge at its showroom in Seoul, July 7, 2016. Getty Images/AFP/JUNG YEON-JE

Samsung Electronics expects its second-quarter operating profit to come in at approximately 8.1 trillion Korean won ($7 billion), a 17 percent year-on-year rise, making it the company’s most profitable quarter in over two years. Revenue in the quarter is expected at 50 trillion won — in line with analysts’ forecasts and a 3 percent increase over the same period last year.

The company, which will report its final earnings later this month, did not disclose its net profit in the preliminary numbers released Thursday.

The growth in operating profit and revenue is believed to have been driven largely by strong sales of its flagship Galaxy S7 smartphones. According to an estimate by Mehdi Hosseini, an analyst for Susquehanna Financial Group, cited by the Wall Street Journal, the company shipped 78 million smartphones in the quarter. Analysts also believe that Samsung sold 15 million Galaxy S7 phones in the same period — up from 10 million units in the previous quarter.

“Some of the features that Samsung introduced in the Galaxy S6 and copied over onto the Galaxy S7 are now being accepted by consumers,” Hosseini said. “Call it a delayed reaction.”

This is in contrast to its American rival Apple, which in April reported its first quarterly revenue decline in 13 years and its first year-on-year drop in iPhone sales.

“Samsung is the only smartphone maker that is faring well these days while competitors like Apple and LG are grappling with slowing demand and Chinese companies are not making profits,” Lee Seung-woo, an analyst at IBK Securities, told the Financial Times. “[However] I am not convinced such momentum can continue through the second half and next year. Smartphone market growth is still slow. ... It all depends on what kinds of products its competitors come up with.”

On Thursday, Samsung’s shares were trading up 2 percent. Year-to-date, the company’s stock has risen nearly 15 percent, outperforming the broader stock index.