By Elizabeth Koh

Samsung Electronics Co. Tuesday forecast a 22.7% rise in second-quarter operating profit, as some components manufacturers ride out the coronavirus pandemic by servicing a boom in internet use fueled by remote working.

The world's largest smartphone and memory-chip maker estimates operating profit of 8.1 trillion South Korean won (about $6.78 billion) for the quarter ended June 30, up from the prior year's 6.6 trillion won.

The estimate, the company said, included a one-time gain related to its display business, though it didn't specify the amount. Samsung is the main supplier for flexible screens used in Apple Inc.'s iPhones.

Samsung also said it expects revenue to decline from the prior-year quarter by more than 7%, falling to 52 trillion won.

The guidance, which precedes Samsung's full report, expected at the end of the month, beat analysts' forecasts of about 6.3 trillion won in operating profit and 50.25 trillion won in revenue, according to estimates gathered by S&P Global Market Intelligence.

The numbers suggest that the global increase in computing demand will, at least for now, provide the Suwon, South Korea, company with a partial life raft through the immediate economic consequences of the Covid-19 pandemic.

The other main profit driver for Samsung, its smartphones business, has a murkier path ahead, analysts said. During the first three months of 2020, global smartphone shipments slid 17% from the prior year, according to market-research firm Strategy Analytics. Samsung saw declines of 19%, while Apple's shipments fell 9%, Strategy Analytics said.

As the pandemic's economic repercussions tanked consumers' desire for premium and pricey handsets, sales for its phones suffered. The company has moved to push more affordable options, like its 5G-enabled Galaxy A71, to woo otherwise reluctant buyers -- undercutting other U.S. entrants by selling the device at around $600.

The latter half of the year will pose another test for Samsung as it unveils its new flagship Galaxy Note 20 phone in early August against the backdrop of weaker consumer demand.

Analysts and industry experts expect semiconductor demand to continue into the second half of the year, though the coronavirus still poses some uncertainty. If that proves to be the case, Samsung stands to benefit substantially from both the demand and the price increases in the memory market, where the company generates more than half of its operating profit.

As countries continue to grapple with how to control the coronavirus's spread, seesawing between reopenings and shutdowns, the shift to working from-home or doing so predominantly online increasingly looks like it will remain the new working normal, analysts said.

Heavyweight customers that operate massive data centers, like Alphabet Inc.'s Google and Amazon.com Inc., have continued to buy up more chips to expand their computing power to keep up with heavier internet usage. The in-demand chips also power other components of internet and communications infrastructure, from 5G base stations to computer processors.

The company also continues to grapple with several legal challenges that resurfaced around Samsung's de facto leader, Lee Jae-yong, last month. Mr. Lee, 51, avoided being issued an arrest warrant in a financial fraud case involving a controversial 2015 intra-conglomerate merger, but he remains on trial in a related bribery case.

Write to Elizabeth Koh at Elizabeth.Koh@wsj.com

Corrections & Amplifications Samsung Electronics Co. forecast a 22.7% rise in second-quarter operating profit Tuesday. An earlier headline and version of this story incorrectly stated a 28.5% rise. Also, last year it had an operating profit of 6.6 trillion won. An earlier version of the story stated 6.3 trillion won.