The extreme weather hit a high-altitude section of the race held in the Yellow River Stone Forest near Baiyin city in northwestern Gansu province Saturday afternoon.
Among the dead were elite Chinese long-distance runners, local media reported.
State broadcaster CCTV on Sunday reported the final missing competitor had been found having "already lost their vital signs", citing the local rescue command headquarters.
"This suggests that this incident caused 21 deaths in total," CCTV said. City officials had earlier confirmed 20 deaths and one person missing at a briefing earlier on Sunday.
Baiyin city mayor Zhang Xuchen said that at around midday a section of the ultramarathon course -- between kilometres 20 and 31 -- was "suddenly affected by disastrous weather".
"In a short period of time, hailstones and ice rain suddenly fell in the local area, and there were strong winds. The temperature sharply dropped," Zhang said.
Shortly after receiving messages seeking help from some participants, marathon organisers dispatched a rescue team that managed to save 18 of the 172 participants.
At around 2pm, weather conditions worsened and the race was immediately called off as local authorities sent more rescuers to help, Zhang said, adding that provincial authorities will further investigate its cause.
The victims included top domestic marathon runners Liang Jing and Huang Guanjun, local media reported, citing a friend of Huang's and Wei Pulong, Liang's coach. Liang had won multiple Chinese ultramarathons in recent years.
Huang, who was deaf-mute, won the men's hearing-impaired marathon at the 2019 National Paralympic Games held in Tianjin. Marathon organisers confirmed his death to a friend, who was cited in local media.
State news agency Xinhua reported that some of the runners suffered from hypothermia, and Zhang said earlier that eight people were being treated for minor injuries in hospital and were in a stable condition.
Video footage broadcast on state media showed emergency rescue personnel in combat fatigues carrying flashlights as they climbed through the rocky terrain at night.
Some marathon participants, wrapped in heavy-duty blankets, were filmed being put on to a stretcher by rescuers.
"My whole body was soaked through, including my shoes and socks. I couldn't stand up straight because of the wind, I was very worried I'd be blown over. The cold became more and more unbearable," one survivor was quoted as saying in local media.
"While descending the mountain, I was already experiencing hypothermia symptoms."
Temperatures in the mountainous terrain dropped further overnight, Xinhua said, making search and rescue "more difficult".
Gansu, one of China's poorest regions, borders Mongolia to the north and Xinjiang to the west.
Deadly floods and landslides have hit the province in the past, with mudslides reportedly killing well over 1,000 people in one town in 2010.
It is also prone to earthquakes.
Yellow River Stone Forest is famous for its rugged mountain scenery marked by stone stalagmites and pillars, and is used as a location in many Chinese television shows and movies, according to the China Daily.
Its rock formations are believed to be four billion years old, the Daily said.
Marathons and extreme sports have seen a surge in popularity among China's middle class in recent years.
However, Chinese marathons have often been plagued by cheating scandals. In 2018, more than 250 runners were disqualified from the Shenzhen half-marathon after they were found to be wearing fake bibs or have taken shortcuts.
So far, a handful of runners have been handed lifetime bans by Chinese sporting authorities for cheating.