BATTLE CREEK, MICH. — Second-quarter sales exceeded expectations at Kellogg Co., especially for ready-to-eat cereal and frozen foods, prompting management to raise earnings and sales guidance for the full year. Cereal consumption surged 16% during the quarter, and the company’s Eggo brand enjoyed 26% growth.

Kellogg’s net income in the second quarter ended June 27 was $354 million, equal to $1.02 per share on the common stock, up 21% from $292 million, or 84¢ per share, in the second quarter last year. Sales were $3.5 billion, unchanged from last year.

The year-to-year sales comparison was worsened by the July 2019 divestiture of the Kellogg cookie, fruit snack, pie crust and ice cream cone business, which the company said carved 6% out of net sales in the second quarter of 2020. Adverse foreign exchange moves cut another 3% from sales. Excluding these items, Kellogg’s net sales in the second quarter rose by more than 9%.

“Amidst the COVID-19 crisis, demand for packaged foods for at-home consumption remained elevated for longer than anticipated,” the company said. “This drove higher sales of the company’s products in retail channels, more than offsetting a related decline in foods sold in away-from-home channels.”

Investors were pleased. With the overall market dipping in early trading July 30, Kellogg shares surged as much as 2.7%, hitting an intraday high of $72.88, up $1.94 a share.

Adjusted operating profit in the second quarter was $562 million, up 24% from the second quarter of 2019.

The strong second-quarter results followed an extraordinary sales surge in March, including ready-to-eat cereal, up 43%; crackers, up 40%; waffles, up 45%; and plant-based meat alternatives, up 66%. In total, sales in the second quarter rose more than in the first.

Kellogg had taken a cautious stance after the first quarter about its outlook and left full-year guidance unchanged but is now raising guidance for the year. The company said earnings per share in 2020 are expected to decline 1% from 2019, versus earlier guidance of a 3% to 4% decline. Organic net sales in 2020, excluding the divested businesses, are projected to be up 5% for the year, versus previous guidance of up 1% to 2%.

In a July 30 conference call with investment analysts, Steven A. Cahillane, chairman and chief executive officer, offered his thoughts about the company’s decision to change guidance.

“We’d assumed that at-home consumption growth would decelerate meaningfully during the second quarter, but with prolonged prices, it held up higher and for longer than we had forecast,” he said. “And in some of our categories, retailers were able to catch up to demand and rebuild inventory. Meanwhile, declines in away-from-home channels persisted, and our emerging markets did not slow down as much as we had expected given COVID disruptions and recessionary conditions.”

With the continued sales strength during the second quarter, Kellogg is positioned to boost investments in the second quarter, Mr. Cahillane said. Certain investments had been deferred earlier in the year.

“This second-half investment is intended to bolster more brands in our portfolio, hone important capabilities, and enhance our competitive position, so that we emerge from this crisis even stronger,” he said.

During the call, Mr. Cahillane enumerated brand building spending that had been delayed, including canceled/delayed sports events, movie releases and innovation launches. Capital spending was deferred as well, resulting in operating profit shifted into the first half of the year.

Kellogg North America operating profit jumped 44% in the second quarter with net sales up 11% on an organic basis. As reported, sales were up 1%. Kellogg attributed the surge in profits to “operating leverage, delayed investment, and a decrease in one-time charges that more than offset the absence of results from the divested businesses and incremental costs related to safety and increased production and distribution related to the crisis.” Excluding special items, operating profit was up 23%.

Breaking down second-quarter results by category, Mr. Cahillane said US cracker consumption rose 9% during the quarter with Kellogg gaining market share.

“Cheez-It continues to grow at a double-digit rate, and we also saw share gains by our Club and Carr’s brands reflecting their orientation toward at-home occasions as accompaniment crackers,” he said.

While Pringles volume rose 12%, the growth trailed the category slightly, Mr. Cahillane said.

The company gained share in its wholesome snacks category, with Pop-Tarts growing at a double-digit rate and Rice Krispies Treats growth as well. Other, more on-the-go oriented products in the category sustained declines during the quarter, including RXBAR.

Turning to RTE cereal, Mr. Cahillane said he was pleased not just by the strength of sales, but by the breadth of the growth. Overall Kellogg’s cereal sales volume was up 16% during the second quarter, beating category growth.

“Importantly, we are gaining share not only behind taste/fun brands like Froot Loops, but also behind health and wellness-oriented brands that we set out to revitalize this year through refreshed messaging and media,” he said.

Brands gaining share included Special K, Mini-Wheats and Raisin Bran.

“We are also excited about the consumer trial and rediscovery we are seeing from new and lapsed users in cereal,” he said. “Household penetration continued to rise sequentially and year-over-year in quarter two, and we are tailoring our messaging and media to reaching out to these consumers. We’re not only growing consumption faster than the category, but we’re also increasing household penetration faster than the category.”

Sales trends during the quarter were “choppy,” Mr. Cahillane said.

“We do see trips down and baskets up, so people load up their pantry, but they are going through it,” he said.

In its North American frozen foods business, the company’s Eggo brand enjoyed sales growth of 26% and Kashi sales rose 19%, with the company gaining share in its three product segments of waffles, pancakes and French toast.

While Morningstar Farms sales rose more than 31%, Mr. Cahillane said the brand lost market share because of capacity constraints. He said the company sees opportunity to boost marketing spending to sustain increased household communication.

“In the second half, we will be investing in this communication as well as in the launch of Incogmeato,” Mr. Cahillane said. “You’ll recall that this is the refrigerated sub-line of our Morningstar Farms brand, whose launch was deferred to the second half because of retailer resets getting delayed because of the crisis.”

Six months through the year, Kellogg’s net income was $704 million, or $2.04 per share, up 22% from $577 million, or $1.66 per share, in the first half of 2019. Sales were $6.9 billion, down 2% from $7 billion last year. Organic net sales were up 9%.