Investors had high expectations heading into PepsiCo's (PEP 1.65%) second-quarter earnings report. While costs are rising and consumer confidence is weakening, the beverage and snack giant has found it relatively easy to boost sales and profits through most of 2022. Wall Street was hoping to see continued signs of expanding revenue into the second half of the year.

Pepsi's Tuesday morning report lived up to the hype. The company boosted sales volume even as its prices jumped. Profit margins weren't hurt much by rising costs, either. And Pepsi raised its already bullish full-year 2022 outlook.

Let's dive right in.

Sales trends

Pepsi's sales trends were strong. Organic sales jumped 13%, in fact, to mark just a small slowdown compared to last quarter's 14% surge. For context, Pepsi had been growing at an annual pace of about 5% before the pandemic. It nearly tripled that prior expansion rate this quarter, even though sales soared in the year-ago period. The 5% reported sales increase trounced expectations for a 1% uptick.

Pepsi got help from an expanding market for branded snacks and beverages. But the company also executed through some major challenges. "Our business momentum continued despite ongoing macroeconomic and geopolitical volatility," CEO Ramon Laguarta said in a press release, "and higher levels of inflation across our markets."

Earnings and cash flow

The news was nearly as good around Pepsi's finances. Operating profit rose 10% after accounting for currency exchange rate shifts, which translated into only a modest drop in profitability. The company endured rising costs on inputs, transportation, labor, and manufacturing, which are contributing to an unusually weak operating profit margin.

PEP Operating Margin (TTM) Chart.

PEP Operating Margin (TTM) data by YCharts.

Yet, Pepsi was able to contain those increases while also boosting its prices. Through the first half of the year, the company has increased sales by 13% while profits expanded by 9%. Pepsi is aiming to achieve a balance between market share gains and profitability. So far, the company is succeeding in walking that line by keeping sales volumes rising while earnings expand at a slightly slower rate.

Looking ahead

Investors were also treated to another outlook upgrade for the 2022 fiscal year. Pepsi entered the year targeting roughly 6% organic growth following soaring results in 2021. Management boosted that target to around 8% last quarter and this week lifted it again to roughly 10%.

Pepsi simply affirmed its earnings target that calls for profits to rise by about 8%, which means the company will likely cede a bit of its profit power because of those soaring costs.

But shareholders should be thrilled to hear that sales trends continue to improve and that Pepsi is finding ways to offset most of the new pressures on the business, such as inflation.

Together with the fact that the company will return $8 billion in cash to shareholders this year, mainly through dividend payments, it's easy to see why many investors are attracted to this stock right now.