WASHINGTON – Macy's Inc., the second-largest U.S. department-store company, posted fiscal third-quarter profit that beat analysts' estimates as better local selections boosted sales, signaling stronger demand headed into the holidays.

Net income in the period ended Nov. 2 rose 22 percent to $177 million, or 47 cents a share, from $145 million, or 36 cents, a year earlier, Cincinnati-based Macy's said Wednesday. The average of 19 analysts' estimates compiled by Bloomberg was 39 cents. Revenue gained 3.3 percent to $6.28 billion, topping the $6.19 billion average projection.

Chief Executive Terry Lundgren drove sales by better matching goods to local demand and intensifying marketing efforts. Revenue was particularly strong in October, and the company is "entering the fourth quarter with confidence," Lundgren said in the statement. That marks a rebound from the second quarter, when sales unexpectedly fell.

"This was a big turnaround," Brian Yarbrough, an analyst with Edward Jones & Co. in St. Louis, said in a phone interview Wednesday. "Macy's is the first of many retailers to report, but it does sound like there is some hope there for the holiday season."

Macy's shares advanced 9.4 percent to close at $50.68 for their biggest gain since June 2009. The shares have climbed 30 percent this year, compared with a 25 percent gain in the Standard & Poor's 500 index.

Sales in November and December account for 20 percent to 40 percent of U.S. retailers' annual revenue and 20 percent of their profit, according to the National Retail Federation, a Washington-based trade group. Last year's fourth quarter accounted for 34 percent of Macy's sales and 55 percent of its profit.

Macy's third-quarter sales at stores open at least a year advanced 3.5 percent, topping analysts' average estimate of a 1.9 percent gain.

Sales trends improved in every region from the spring season, and both the Macy's and Bloomingdale's chains performed well, the retailer said.

The company repeated its forecast that profit in the year through January will be as much as $3.90 a share. Analysts estimate $3.78.