In its earnings preview, the South Korean company put its operating income at KRW 8.1 trillion ($7 billion or roughly Rs. 47,200 crores), compared with KRW 6.9 trillion a year earlier.
That was much higher than forecasts. Analysts predicted KRW 7.4 trillion of operating income according to FactSet, a financial data provider.
It was the best performance in nine quarters. The last time Samsung raked in more than KRW 8 trillion of operating income was during the January-March period in 2014 when it reported KRW 8.5 trillion in operating profit.
Sales rose 3 percent to KRW 50 trillion. Samsung did not give its net profit or breakdowns among its business divisions.
The company is the world's largest maker of smartphones, televisions, memory chips and display panels. Each of Samsung's four business divisions likely showed strong results during the latest quarter, according to analysts. Key products of each business division - the Galaxy S7 smartphones, ultra-high definition TVs, solid state computer storage devices and thin and light displays known as OLED - all saw solid demand.
The most important drive behind its forecast-beating earnings was smartphones. In recent weeks, analysts revised up their forecasts on Samsung Electronics saying that Samsung's mobile business performed better than expected thanks to robust sales of the Galaxy S7 smartphone models.
The optimistic view reflects a shift from earlier this year when analysts thought Samsung's best year was behind it and that its annual profit would fall, largely because they saw Samsung's mobile growth coming to a halt.
After the release of the Galaxy S7 and S7 Edge smartphones in spring, however, the mood has changed. While Apple's flagship iPhone sales slowed, analysts predicted that Samsung's mobile profits would gain this year.
"Foreign investors' sentiment toward Samsung Electronics is quickly changing after the second quarter," CW Chung, an analyst at Nomura Financial Investment Co., said before Samsung's disclosed its earnings preview.
"We think it is the most promising stock among Asian tech companies," Chung said.
Shares of Samsung Electronics have surged nearly 20 percent since January.
Some analysts said Samsung's new strategies with its flagship phones paid off since Samsung launched the Galaxy S7 and the S7 Edge smartphones in March, a month earlier than it did with the previous flagship phone.
The camera and the battery life of the S7 smartphone were better than in the older models and the phone was water resistant, but its price was lower.
In 2015, the company struggled to meet demand for smartphones with curved displays, but this year component supply issues have been resolved and some analysts believe the higher-priced S7 Edge smartphones, which feature curved displays, saw stronger performance than its sister phone with a flat screen.
Samsung is expected to announce the latest version of its Galaxy Note smartphone - featuring a larger screen and a stylus - in the fall.
IBK Securities analyst Lee Seung-woo estimated Samsung sold 16 million Galaxy S7 and S7 Edge smartphones in the second quarter, with slightly more than half of its quarterly profit coming from the mobile division.
Analysts said besides the high-end S7 smartphone, the company's its middle-of-the-line J series smartphones are doing well in countries such as India, which helped its profit gain.
For the latest tech news and reviews, follow Gadgets 360 on X, Facebook, WhatsApp, Threads and Google News. For the latest videos on gadgets and tech, subscribe to our YouTube channel. If you want to know everything about top influencers, follow our in-house Who'sThat360 on Instagram and YouTube.