The company, which reported a better-than-expected third-quarter profit, pointed to increased spending, despite mixed signals about consumer confidence during the quarterly earnings season and competition from rivals targeting health-conscious consumers.

“I think we can see that there’s firming in the category,” Chief Executive
J.P. Bilbrey
said on a call Friday with analysts. “We think people are, across all income cohorts, beginning to spend a little more confidently than they have before.”

Mr. Bilbrey is to step down in July.
Michele Buck,
promoted last summer to chief operating officer and a likely CEO candidate, is taking on such challenges as an increased presence of health-focused snacks at checkout lanes and rival chocolate brands upping their game.

“There has been a bit more competition” from healthy items, Ms. Buck said Friday.

Hershey, which also makes Reese’s Peanut Butter Cups and Jolly Ranchers, reported a 46% rise in third-quarter profit as sales rose 2.2% from a year earlier to $2 billion.

Hershey now expects full-year earnings, adjusted to exclude certain items, of $4.28 to $4.32 a share; that is four cents higher than its previous estimate.

Shares rose 7.2% to $102.40 in Friday trading.

Over the summer, Mondelez made an offer, but Hershey’s board wanted more money for the iconic company. In August, Mondelez announced an end to its pursuit, leaving Hershey to pursue alone an expansion overseas and into the snack aisle.

Over the past couple of years, Hershey has bought Krave beef jerky, created a line of protein bars and squeeze pouches called SoFit, and come out with snack mixes of chocolate, pretzels and nuts, in an effort to broaden its reach.

Meanwhile, M&M’s maker Mars Inc. is merging operations with its Wrigley gum division, giving it more leverage with retailers. And Mondelez is bringing its European chocolate brand Milka to the U.S., with its Oreo chocolate bar coming out around the same time as Hershey’s Cookie Layer Crunch.

Hershey reported profit of $227.4 million, or $1.06 a share in the latest quarter, compared with $154.8 million, or 70 cents a share, a year prior. Excluding certain one-time factors, earnings were $1.29 a share, up 10% from the prior year and topping analysts’ estimate of $1.18 a share, according to Thomson Reuters.

Hershey’s relatively new Chinese business contributed to the performance with a 15% rise in sales during the quarter in local currency terms.

In North America, which accounts for nearly 90% of sales, revenue rose 1.8% to $1.76 billion.

India and Canada were trouble spots, though, with sales falling 7.7% in Canada and 21% in India in local currency terms.