SHANGHAI — China, the largest foreign holder of United States debt, said Saturday that Washington needed to “cure its addiction to debts” and “live within its means,” just hours after the rating agency Standard & Poor’s downgraded America’s long-term debt.

The harshly worded commentary, released by China’s official Xinhua news agency, was Beijing’s latest effort to express its displeasure with Washington.

Beijing’s reaction to the downgrade was the harshest among foreign leaders. Japan — which held $882 billion in United States Treasuries at the end of last year, making it the second-biggest overseas holder of American debt — did not release any official statement about the downgrade. A Finance Ministry official said he could not comment.

Though Beijing has few options other than to continue to buy United States Treasury bonds, Chinese officials are clearly concerned that the country’s substantial holdings of American debt, worth at least $1.1 trillion, are being devalued.