The aid, extended through the China International Development Cooperation Agency, includes 5,000 tonnes of rice, pharmaceuticals, production materials and other essentials, Sri Lanka's foreign ministry told reporters on Thursday (April 21).
The announcement came after a meeting between Sri Lankan Foreign Minister G.L. Peiris and the Chinese ambassador in Colombo, Mr Qi Zhenhong.
In March, the envoy told a press conference that Sri Lanka had sought a US$2.5 billion loan and credit line from China. It was not clear if the US$31 million was part of this request. China's Yunnan province has also announced a donation of 1.5 million yuan (S$315,000) worth of food packages to Sri Lanka.
Long blackouts, shortages of food and medicine have triggered nationwide street protests in the island nation.
Citizens are demanding that President Gotabaya Rajapaksa and his brother, who is the Prime Minister, Mr Mahinda Rajapaksa, resign.
Both have shown no sign of doing so. But the Prime Minister on April 18 proposed restoring a law that clips the president's powers and empowers Parliament as a short-term solution.
Finance Minister Ali Sabry has gone to Washington to negotiate a debt restructuring plan with the International Monetary Fund, a crucial step after the government in Colombo declared last week that it would default on its foreign debts totalling around US$51 billion.
Sri Lanka's foreign currency reserves are worryingly low at around US$500 million, and it hopes to use the money to import essentials such as rice, fuel and medicine as it looks for loans and grants from friendly nations to shore up reserves.
Beijing has extended $1.3 billion in syndicated loans since the outbreak of the Covid-19 pandemic, and a US$1.58 billion renminbi-denominated currency swap in December but since then has been silent.
As protesters hold the Sri Lankan government accountable for economic mismanagement such as borrowing unsustainably from international markets and taking loans from China for ill-advised and loss-making infrastructure projects, experts say that Beijing was perhaps keeping a low profile.
Mr George Cooke, founder of Colombo-based think-tank Awarelogue Initiative, said: "We have seen a lot of silence on China's part. I believe it is because Sri Lanka's foreign ministry has just not been campaigning vigorously enough for assistance from friendly nations like China, Japan and South Korea.
"India has meanwhile been offering proactive help."
India, Sri Lanka's northern neighbour, announced US$500 million in financial assistance on April 20 to buy fuel, in addition to US$1.9 billion in loans, credit lines and currency swaps.
It also sent ships with sugar, rice and medicine.
President Rajapaksa has thanked India for its "invaluable assistance".
New Delhi has been keen for Colombo to diminish its economic relations with Beijing that have grown over the past decade under the Rajapaksas and former prime minister Ranil Wickremesinghe.
Said Mr Umesh Moramudali, who teaches economics at the University of Colombo, and researches Sri Lanka's public debt dynamics: "There is a clear shift in China's approach to Sri Lanka, in that it pledged assistance but waited for Sri Lanka to have a clear debt restructuring plan.
"Or maybe it was a reaction to Sri Lanka's recent close relations with India."
While India has provided aid with essentials, economists say Sri Lanka's urgent need for dollars has left it with no option but to seek help from China.
"It's important to get China's help, specifically through the kind of term financing facilities it has offered in the past, to strengthen foreign reserves," said Mr Moramudali.
Credit lines give fuel or food on credit and do not increase currency reserves. Term loan facilities, on the other hand, will give Sri Lanka the dollars it needs to freely spend on imports from any country.
Chinese loans make up around 20 per cent of Sri Lanka's total foreign debt, including US$1.2 billion in term loan financing from China Development Bank in 2020 and 2021.
Mr Moramudali said: "Western and Indian media claims about the Chinese debt trap being the main cause of Sri Lanka's economic crisis are exaggerated."
Sri Lanka's biggest debt burden comes from sovereign bonds, or borrowings from the international market, which make up 40 per cent of its foreign loans. These bonds also account for half of Sri Lanka's international debt repayments every year.
Sri Lanka cannot afford to ignore help from any commercial partner to repay maturing bonds and improve currency reserves, Mr Moramudali added.
By Rohini Mohan
Asia News Network: The Nation (Thailand), The Korea Herald, The Straits Times (Singapore), China Daily, Jakarta Post, The Star and Sin Chew Daily (Malaysia), The Statesman (India), Philippine Daily Inquirer, Yomiuri Shimbun and The Japan News, Gogo Mongolia, Dawn (Pakistan), The Island (Sri Lanka), Kuensel (Bhutan), Kathmandu Post (Nepal), Daily Star (Bangladesh), Eleven Media (Myanmar), the Phnom Penh Post and Rasmei Kampuchea (Cambodia), The Borneo Bulletin (Brunei), Vietnam News, and Vientiane Times (Laos).