New York CNN Business  — 

Nobody in their right mind likes to pay higher prices for stuff. But if you’re an investor, there is a way to profit from inflationary trends — and it might be time to start adjusting your portfolio accordingly.

Consumer staples giants like Coca-Cola (KO) and Pepsi (PEP) can benefit from rising prices — as long as they are able to pass on some of those costs to customers. And that’s what some companies are doing.

J.M. Smucker (SJM), which makes a wide range of products including Jif peanut butter and Folgers coffee, has been raising prices, for example. And that has not appeared to hurt demand, or the stock. Shares of Smucker (SJM) rose more than 5% Tuesday after the company reported earnings and sales that topped forecasts.

Smucker chief financial officer Tucker Marshall noted during a conference call that the company has been able to offset increased costs for coffee and transportation with higher prices.

Even some retailers are finding they can raise prices to offset higher costs and not alienate customers in the process.

Apparel company Guess, which reported strong earnings and sales Tuesday afternoon, said that it is managing rising cotton prices by cutting down on discounts in its stores. Guess shares surged nearly 15% Wednesday on the news.

“We have done a lot to reduce promotional activity,” said Guess CEO Carlos Alberini, during a conference call with analysts. “We have also increased prices, and we have done this very strategically.”

A higher level of inflation — and the rising long-term interest rates and spiking commodity prices that are accompanying it — are also boosting banks, raw materials companies and energy stocks.

In fact, fund manager Horizon Kinetics launched an Inflation Beneficiaries ETF earlier this year that has big exposure to the financial services and commodities sectors.

Top holdings include private land owner Texas Pacific (TPL), New York Stock Exchange parent company Intercontinental Exchange (ICE) and food giant Archer Daniels Midland (ADM).

The fund is up 26% since it began trading in mid-January, better than the Dow, S&P 500 and Nasdaq during the same time frame.

But stocks aren’t the only way for investors to profit from inflation.

Analysts at the Wells Fargo Investment Institute pointed out in a report this week that commodities such as gold, oil and agricultural products — considered real assets, or those you can see, touch and taste — have outshone the broader market by a wide margin during periods of high inflation in the 1970s, late 1980s and early 2000s. That could happen again.

“Oftentimes, real asset price increases are what fuels inflation in the first place,” the analysts said, “so we believe investing in these assets can work as a natural hedge against rising costs in our everyday lives.”