China has for years had one of the lowest retirement ages among major economies. Men started life’s next chapter at age 60, while women did so as early as 50.

China’s next generation will have to work for longer.

To address looming pension-system shortfalls and economic strains , Chinese lawmakers on Friday moved to gradually raise the statutory retirement age to 63 for men and 55 for blue-collar women. The retirement age for other women will increase to 58 from 55.

The long-awaited plan will affect most working people in China, but none of it will happen fast.

Over the next 15 years, retirement benchmarks will be delayed a few months each year according to a complicated schedule that varies for different groups. In short, the younger workers are, the longer they will be expected to work.

Chinese officials have long telegraphed that the country needs to raise retirement ages unchanged since the 1950s, but the news nonetheless came as a blow to many Chinese.

Across social-media platforms, middle-aged workers, especially those approaching retirement, expressed confusion and dismay about the plan.

“I’ll just retire now,” one posted on WeChat, China’s do-everything app.

The National People’s Congress, China’s top legislative body,  flagged that the change was coming earlier this week but didn’t give details. After the approval of the measure Friday, all state media outlets immediately published tables, charts, illustrations and even an online calculator to help working Chinese people predict when they can retire.

It is rare for an important policy decision to get into so much detail, said Changhao Wei , a fellow at the Paul Tsai China Center of Yale Law School, who saw it as a sign that Chinese leaders expected pushback from the public.

“The authorities were likely determined to push this retirement plan through and were likely aware of the unpopularity of the measure,” said Wei, who has been closely following China’s legislative sessions.

Chinese authorities must also be careful about how the new retirement age might affect the  millions of young Chinese having trouble finding work . Youth-unemployment rates  hit 17.1% in July .

“Older people can’t retire, and younger people can’t find jobs,” read one post on Chinese social-media platform Weibo.

Another post joked that in 20 years, young people will be sitting at home, playing videogames and living off their parents “because the jobs are all taken by their parents and grandparents.”

Retirement ages will be gradually raised starting in January. In addition, beginning in 2030, China will slowly increase how long people must contribute to pension systems before they can benefit from them. The current minimum of 15 years will rise to 20 years.

Other big economies are also trying to shore up pension systems and maintain economic productivity as people live longer and have fewer children. U.S. Social Security estimates that, without major changes, it can’t fully pay beneficiaries starting in 2034 . France last year raised its retirement age to 64 from 62,  triggering nationwide protests .

What makes China different is its exceptionally low retirement age, which even after the overhaul will still be lower than the U.S. and Western European norm of 67. China’s demographic challenges were also heightened by its decadeslong one-child policy , scrapped in 2016.

An estimated 11 million workers will reach retirement benchmarks next year, Julian Evans-Pritchard at Capital Economics wrote in a research note Friday. The overhaul should help boost the number of workers in the short term and put the pension system on a more sustainable footing, the economist wrote.

The move helps China maintain economic productivity , said Bert Hofman , a former World Bank country director for China now teaching at National University of Singapore’s East Asian Institute. “Over the next 15 years, more and more better-educated people will retire,” Hofman said. “You want to keep them in the labor force longer because they will still be productive.”

Some Beijing critics called the gradual implementation too slow. “This pace is no different from kicking a political time bomb to future generations,” said Yi Fuxian , a researcher at the University of Wisconsin-Madison who has long criticized China’s demographic policies.

Write to Stu Woo at Stu.Woo@wsj.com and Liyan Qi at Liyan.qi@wsj.com