NEW YORK — McDonald’s CEO Don Thompson is stepping down as the world’s biggest hamburger chain fights to hold on to customers and transform its image.

The company said Thompson, who has been CEO for two-and-a-half years, will be replaced by Steve Easterbrook, a company veteran who rejoined McDonald’s as its chief brand officer in 2013.

McDonald’s Corp., which has more than 36,000 locations around the world, is struggling amid intensifying competition and changing attitudes about food. Customer traffic at established locations in the U.S. fell 4.1 percent last year, following a 1.6 percent decline in 2013. It’s also trying to recover after a supplier scandal in China that damaged its reputation.

On Wednesday, McDonald’s said Thompson will retire March 1 after nearly 25 years with the company. Thompson, 51, was the first African-American to head the company since it was founded in 1955.

“It’s tough to say goodbye to the McFamily, but there is a time and season for everything,” he said in a statement.

A representative for McDonald’s said an unspecified number of employees at the company’s headquarters in Oak Brook, Illinois, and elsewhere were also notified of layoffs on Wednesday. In after-hours trading, shares of McDonald’s jumped 3 percent to $91.79. The stock has declined about 6 percent in the past year while broader markets are up in the double digits.

With Easterbrook’s promotion, McDonald’s is continuing its tradition of promoting from within, noted Darren Tristano, a restaurant industry analyst with Technomic. That could be a drawback for a company that is struggling to keep up with a rapidly changing industry.

“Sometimes, you need fresh perspective,” Tristano said, adding that the competition has been “evolving faster than McDonald’s products have been.”

Despite the pressures McDonald’s is facing, the timing of Thompson’s departure was a bit of a surprise considering the numerous revitalization efforts the company recently announced, said Richard Adams, a consultant for McDonald’s franchisees. And he noted the CEO change raises the question of whether McDonald’s will stay with those initiatives.

“Is everything going to change, or are Don’s plans going forward?” Adams said.