For nearly 24 years, the father crossed China by motorbike. With banners displaying photos of a 2-year-old boy flying from the back of his bike, he traveled more than 300,000 miles, all in pursuit of one goal: finding his kidnapped son.

This week, Guo Gangtang’s search finally ended. He and his wife were reunited with their son, now 26, after the police matched their DNA, according to China’s public security ministry.

In a scene captured by Chinese state television, the trio clung to each other tearfully at a news conference on Sunday in Liaocheng, Mr. Guo’s hometown in northern Shandong Province.

“My darling, my darling, my darling,” Mr. Guo’s wife, Zhang Wenge, sobbed as she embraced the young man. “We found you, my son, my son.”

“He’s been delivered into your hands, so you need to love him well,” Mr. Guo said, trying to comfort her even as his own voice shook.

The apparent happy ending captivated China, where Mr. Guo has become something of a folk hero. His cross-country odyssey, during which he said he was thrown from his bike at least once and slept outdoors when he could not afford a hotel, inspired the 2015 film “Lost and Love,” starring the renowned Hong Kong actor Andy Lau.

After the reunion, Chinese social media filled with congratulatory messages. Hashtags about the Guo family were viewed hundreds of millions of times. “Today, ‘Lost and Love’ finally has a real happy ending,” the movie’s director, Peng Sanyuan, said in a video on Douyin, a social media app.

Child abduction is a longstanding problem in China. There are no official statistics on the number of children kidnapped each year, but officials at the Ministry of Public Security said this month that they had located 2,609 missing or abducted children so far this year. Various reports estimate the number of children abducted annually in China may be as high as 70,000.

Historically, child abduction was linked, at least in part, to China’s one-child policy. At the height of the policy’s enforcement in the 1980s and 1990s, some couples resorted to buying young boys on the black market to ensure they would have a son, according to research by scholars at Xiamen University in Fujian Province. Chinese society has traditionally favored sons.

As the central government began easing enforcement of the policy in the early 2000s — before ending it in 2015 — reported abductions fell sharply. Technological advances such as a nationwide DNA database of missing children, stiffer criminal penalties and greater public awareness of child trafficking have also helped curb the problem, said Zhang Zhiwei, executive director of an anti-trafficking center at the China University of Political Science and Law.

Still, the threat of abduction continues to weigh on many Chinese. On Monday, several police departments in the eastern city of Hangzhou issued statements denying viral rumors about attempted kidnappings.

Mr. Guo’s son, named Guo Xinzhen at birth, disappeared on Sept. 21, 1997. He had been playing at the door of his home while his mother cooked inside, according to interviews the elder Mr. Guo has given over the years.

A frantic Mr. Guo and his wife, along with family, neighbors and friends, fanned out across the region to search for the boy. But after several months, the effort waned. That was when Mr. Guo attached large banners printed with his son’s photo to the back of a motorcycle and set out to find the boy on his own.

“Son, where are you?” the banners said, alongside an image of the boy in a puffy orange jacket. “Dad is looking for you to come home.”

Over the years, Mr. Guo wore out 10 motorcycles, traveling from Hainan in the south to Henan in the north, chasing down any tidbits of information, he has said. Once, on a rainy day, a rock slipped off a truck bed in front of him, sending his motorcycle toppling. He had so many near-miss traffic incidents that he lost count. But he always set out again.

“If I’m at home, the human trafficker is not going to deliver him back to me,” he said in a 2015 interview with state television.

In 2012, Mr. Guo founded an organization to help other parents find their missing children, and he said he has helped dozens of other families find their loved ones, even as his own search remained unsuccessful. His story rose to national prominence with the 2015 film. Earlier this year he also began promoting anti-trafficking awareness on the social media app Douyin, where he had gained tens of thousands of followers even before his son was found.

The latest development in Mr. Guo’s story also seemed like something straight out of a screenwriter’s imagination.

In June, law enforcement officials in Shandong received notice of a potential match for Mr. Guo’s son in Henan Province, according to the public security ministry. It was not immediately clear how officials had identified him, though they said they had used “the newest comparison and search methods.” Further blood work confirmed that the 26-year-old man, who some local news reports said was working as a teacher, was Mr. Guo’s son.

The authorities later said that they had arrested a woman surnamed Tang and a man surnamed Hu. According to the state news media, Ms. Tang snatched the boy and delivered him to Mr. Hu, who then sold him. CCTV, the state broadcaster, said the two had confessed.

Ahead of the reunion, a dazed Mr. Guo and his wife bought more than 1,000 pounds of candy to distribute to neighbors in celebration. Mr. Guo also cleaned out his home, tossing out old belongings to commemorate a new beginning.

In an interview ahead of the reunion with Chen Luyu, a talk-show host, the parents veered between jubilation and paralysis. Sitting at their dining table, Ms. Zhang, Mr. Guo’s wife, broke down several times, wondering if their son would blame her for not watching him closely enough.

Mr. Guo said he bore no resentment toward the couple that had raised his son. How his son would treat that couple going forward was up to him, he said.

“If the child wants to be filial to his adopted parents, then you just need to openly and sincerely accept that,” he said.

State media reports said that the younger Mr. Guo had said he would continue living with the couple that had raised him, who he said had treated him well. But he said he would visit his birth parents often.

The elder Mr. Guo told Ms. Chen, the television host, that he was content with whatever the future brought.

“Our child has been found,” he said. “From now on, only happiness is left.”