TOKYO • Clad in jeans and a T-shirt, seven-year-old Yamato Tanooka wandered 5km to a military base in a forest after his parents left him by the side of a mountain road to discipline him.
There, he found a tap to drink from, sought shelter inside one of the cabins that was left unlocked, and slept between two mattresses to keep warm in temperatures that plunged to 7 deg C overnight.
Survival experts say good luck and sensible decisions helped the boy survive nearly a week by himself in the Hokkaido wilderness where brown bears roam.
The case has gripped the nation, eclipsing even news about Japan's upcoming elections. National broadcasters yesterday interrupted regular programmes to broadcast news of Yamato's discovery.
The boy was found by chance early yesterday, nearly a week after he was reported missing last Saturday.
Three soldiers from the Japan Ground Self-Defence Force found him after they had ducked into the cabin to avoid rain, a military spokesman was quoted as saying by The New York Times. They found a child curled up on a mattress.
"When asked 'Are you Yamato?', the boy replied 'Yes'," a member of the force told NHK national television.
"Then he said he was hungry, so the soldier gave him some water, bread and rice balls," he added.
The boy was then transported to hospital for further examination and was reunited with his family, reported Agence France-Presse.
Aside from a few scratches on his arms and legs, dehydration and mild hypothermia, he had no serious injuries, doctors told Asahi TV.
Yamato said he had "walked through the mountains" until he found the cabin last Saturday night.
"I didn't have food, so I just drank water," police quoted him as saying.
Members of the search team, which included about 200 police officers, military personnel and volunteer rescue workers, burst into applause when told the good news.
At Yamato's elementary school in the town of Hokuto, Hokkaido, shouts of joy erupted during the school assembly when pupils heard the news, reported Kyodo News.
Mr Ross Findlay, founder of the Niseko Adventure Centre in the region, told the BBC that in the boy's circumstances, he had acted in the best possible way.
"He found himself shelter, water and something to keep himself warm, so I don't think you can do too much apart from that," he said. "It is quite a miracle, really, after six days."
It was a good thing the boy did not stray from the cabin, which was used as sleeping quarters for soldiers during training.
"It is much harder to be found if you are moving about. People can be more easily found from their last known location," Mr David Niehoff, president of Kanto Adventures, told BBC News.
Speaking to reporters after the child was found, the boy's father, Mr Takayuki Tanooka, apologised for causing trouble.
"The first thing I said to him was that I was really sorry. He nodded and said 'Okay', like he understood," said the 44-year-old, his voice breaking. "He looked well and did not appear to have lost any weight. He is safe - that is the most important thing."
Yamato's parents first said he disappeared while they foraged for edible plants, but later told police they had left him by the road to discipline him after he threw stones at people and cars.
They said when they drove back a few minutes later, the boy had disappeared, reported Reuters.
"I thought that this discipline would be good for him, but it was over the top. I am very sorry for causing so much trouble," the father said yesterday.
News of Yamato's discovery was the top trending item on social media in Japan. One social media user wrote: "It is the boy's father who has learnt the big lesson."