By Sharon Terlep

Procter & Gamble Co., maker of household staples from Tide detergent to Charmin toilet paper, posted its strongest annual sales gain since 2006 as the pandemic kept the world's consumers at home and vigilant about cleaning.

Demand in the U.S. for cleaning and paper products continued to surge through the spring and early summer, while the reopening of China, P&G's second-biggest market, drove sales there. P&G executives said the company's efforts in recent years to overhaul itself by shedding weaker brands and streamlining what they described as an often suffocating bureaucracy are paying off at a time of crisis.

The Cincinnati company's organic sales were up 6% for the fiscal year ended June 30. For the latest quarter, organic sales also rose 6%.

P&G predicted more modest growth of 2% to 4% for the current fiscal year, citing high uncertainty around the global economy, especially in developing countries, and fallout from the new coronavirus.

"On the whole, with health, hygiene and cleaning, consumers' needs have changed forever," Chief Financial Officer Jon Moeller said. "Maybe not to the degree that's happened recently. But it's hard to imagine we'll snap back to the old world."

The strongest growth was in P&G's fabric and home-care unit, which posted a 14% sales gain, its highest ever. The unit's brands include Tide along with Mr. Clean, Dawn dish soap and Cascade dishwasher detergent.

China sales recovered in recent months after sliding at the start of the year, when the country shut down in an effort to contain the virus. Closed factories, roads and stores stymied production and kept Chinese consumers from buying. Organic sales in China rose 14% in the quarter and 8% for the full year.

P&G has yet to show signs of being negatively affected by the recession, as consumers remain willing to pay higher prices for its products. A question facing the company, given that its products are generally more expensive than rival brands, is whether it would fare better in an economic downturn than it did during the last recession, when sales growth plunged to anemic levels and took a decade to recover.

The company has worked in recent years to improve offerings for more budget-conscious consumers.

"We expect that if this gets longer and deeper, people will have to make choices," P&G Chief Executive David Taylor said. "The good news is that, unlike last time, we have a broader portfolio."

Price increases continued to help drive sales gains in the most recent quarter, with sales volumes also growing stronger in recent months. Before the pandemic, consumers proved willing to buy without discounts the more-expensive products it has developed. Those price increases continued through the most recent quarter and helped offset losses due to currency moves.

P&G and its consumer-staples rivals such as Kimberly-Clark Corp. and Clorox Co. have cut back on deals and discounts as so many of their products -- paper towels, disinfectants, sanitizing wipes -- are in such high demand that consumers buy whatever they can find.

P&G is wading more into cleaning products, both by chance and because of the pandemic.

In February, it launched a household-cleaning line, Microban 24, that the company says can be used against the new coronavirus. It also offers 24-hour protection against bacteria, though not any viruses. In recent weeks the company also quietly rolled out a hand sanitizer to a limited number of U.S. retailers. P&G had been making Safeguard hand sanitizer for use by its workforce and by the government, health-care entities and relief organizations.

Mr. Taylor said the company is working to ramp up capacity of both products.

P&G kept all its U.S. manufacturing operations running through the pandemic, and employees have since returned to work at product-development facilities and in offices, though at much reduced levels.

Mr. Taylor said operating in the pandemic demonstrated that the company had room to improve productivity even after a major restructuring, noting that some factories were at times able to operate at 90% capacity even with staffing levels cut in half. "There's more there," he said.

P&G entered the fiscal year predicting organic sales growth of 3% to 4%, slower than the 6% it delivered.

For the fiscal fourth quarter, it swung to a profit of $2.8 billion from a $5.2 billion loss a year earlier, when the company reported an $8 billion write-down of its Gillette brand. Sales for the quarter were $17.7 billion, higher than the $17 billion forecast by analysts, according to S&P Global Market Intelligence.

The company's adjusted quarterly profit of $1.16 a share was above the average $1.01 projected by analysts.

For the fiscal year, P&G reported revenue of $71 billion and profit of $13 billion. Adjusted annual profit was $5.12 a share, higher than analysts' estimate of $4.97.

P&G shares, which are up 13% over the past year, reached records this week. Shares were up 2.3% in afternoon trading Thursday in an overall down market.

Write to Sharon Terlep at sharon.terlep@wsj.com