Before the pigs arrived, Yu Anhen and her husband eked out a living as subsistence farmers in the remote mountains of Guizhou, one of China’s poorest provinces. Then, two months ago, a government official came to them with an offer of 5,000 yuan ($735) to buy three piglets. Ms. Yu eagerly said yes. She saw it as an opportunity to ease her family’s finances and help pay for her son’s college tuition.

“My husband and I are getting old and it’s getting harder for us to work outside,” Yu says. “Raising pigs will help us.”

The largest pig should be ready for market in four to five months, where Yu hopes it will sell for about 3,000 yuan ($440). If the other two go for a similar price, she and her husband will be out of poverty, as China defines it, for the first time in their lives – and Beijing will be a fraction closer to its goal of eliminating poverty entirely by 2020.

Recommended: How much do you know about China? Take our quiz.

China has been at the forefront of the world’s poverty-reduction efforts for nearly four decades. More than 700 million people in the countryside have risen out of poverty, largely thanks to China’s economic boom. But there's an asterisk next to those accomplishments. Beijing considers people poor if they earn less than 2,300 yuan ($335) per year. By World Bank global standards, less than $700 qualifies as extreme poverty.

Today, in a country of 1.3 billion, 43.35 million people meet Beijing's definition of poverty. That number is down to 250 in Tuanjie, a shabby village of 3,000 people that is surrounded by terraced corn fields and green mountains in southwestern China. If all goes as planned, says Xiong Jun, the village head, “We will leave poverty in 2019.”

Mr. Xiong’s confidence is buoyed by the sheer scale of China’s poverty alleviation campaign, whose strategies include relocations, cash handouts, and job training. While much attention has focused on President Xi Jinping’s ambitious foreign-policy initiatives – from his military build-up in the South China Sea to the $900 billion “One Belt, One Road” infrastructure and trade program – poverty alleviation has emerged as one of his top domestic priorities.

The Chinese government has allocated more than 140 billion yuan ($20.5 billion) for poverty alleviation programs this year alone. For Mr. Xi, pulling everyone out of poverty is “the baseline task for building a moderately prosperous society.” But as the campaign enters its final stretch and as China’s economy slows, the work is likely to only get harder.

The campaign ramped up two years ago after Xi paid a visit to Guizhou on June 18, 2015. A week earlier, four young siblings in a village not far from Tuanjie had committed suicide by drinking pesticide, after their parents abandoned them in search of work. Their deaths sparked a national debate about rural poverty, with some blaming local officials for a lack of services, and renewed the government’s push to end it.

“Poverty is nothing to fear,” he said in the impoverished village of Huamao. “If we have determination and confidence, we can overcome any difficulty.”

The landlocked province of Guizhou has since emerged as ground zero. In April, Chen Miner, the provincial party chief and one of Xi’s close allies, reaffirmed his commitment to helping more than 3.7 million people in the province escape poverty over the next three years. More than 750,000 will be relocated from mountainous villages to more prosperous towns and cities this year. In a move underscoring Xi’s support for the campaign, party members in Guizhou unanimously elected him to represent the province at the important 19th National Communist Party Congress that will take place this fall.

Considerable hurdles remain. Analysts say the next 2-1/2 years will be the hardest because many of the remaining poor in China have physical or mental disabilities that make it difficult to hold down a steady job. The Civil Affairs Ministry announced in January that about 40 percent of China’s poor are poor because of their health.

Meanwhile, corruption and bureaucratic inefficiencies have hampered poverty alleviation programs across the country. In March, the party secretary from the county that includes Tuanjie was expelled from the party and faces criminal charges for having allegedly embezzled more than 174,000 yuan ($25,000). In 2016, authorities launched a five-year campaign against corruption in the anti-poverty programs, but problems persist.

Then there’s the physical challenge. The government plans to relocate 3.4 million people from poor areas by 2020, but providing support to people who remain in China’s most remote communities is no easy task.

“We’re getting to a point now where it’s more difficult to access these populations,” says Ben Westmore, a senior economist at the Organisation for Economic Cooperation and Development (OECD) who has studied China’s poverty alleviation efforts. “There aren’t deep pockets of poverty anymore. It’s more widely spread, which can be more of a challenge to target.”

Perhaps nowhere is that truer than in the steep mountains and isolated hamlets of Guizhou. But the province’s budding technology industry may help not just with jobs, but government oversight. Officials in a district of Bijie, the prefecture-level city that includes Tuanjie, have developed a smartphone app for tracking every person and household below the poverty line. Field workers can use the app to look up information about poor families across the district and to provide updates. Zhu Yongzhen, deputy director of agriculture for the district, says the app will soon include a “public supervision” feature to improve transparency.

For now, Mr. Zhu uses the app whenever he visits one of the 12 households he supervises. He’ll upload photographs and write brief messages to explain how much progress they’ve made. Sometimes he’ll write simple observations, like he did on a recent visit to an elderly couple’s home.

“The government takes care of them,” he wrote. “They don’t need to worry about their food and clothes. Hope they keep healthy.”