HOUSTON — Standard & Poor’s stripped Exxon Mobil of its top credit rating on Tuesday for the first time since the Great Depression, signaling that even the mightiest oil company cannot escape the worst oil and gas slump since the 1980s.

Only two American companies now have an S.&P. AAA rating — Microsoft and Johnson & Johnson. Nearly every oil and gas company has been downgraded recently; scores of mostly small ones have filed for bankruptcy protection.

But investors shrugged off the downgrade to AA+, still a stellar rating, and slightly bid up Exxon Mobil’s stock price on Tuesday to close at $87.63. Standard & Poor’s described the company’s financial situation as “stable.” The downgrade, though, will probably raise the company’s borrowing costs and may lower somewhat its status among state oil companies as the premier partner to have for complex project development.

Most important, the downgrade was another warning that the company was coming under pressure from persistently low oil and natural gas prices as it also faced investigations of several state attorneys general into accusations that the company tried to mislead the public about .

It also underscored a persistent problem Exxon Mobil and other large oil companies have tried to solve with only mixed success in recent years: finding additional reserves to replace the oil and gas it pumps out of the ground every day. Unfortunately for the companies, many of those new reserves can be found only in places that carry political risk or are so deep in the ocean or high in the Arctic that they are prohibitively expensive to produce when commodity prices are low.

“It shows you low oil prices humble even the mighty,” said Fadel Gheit, a senior oil analyst at Oppenheimer. “They are off the gold standard.”

The ratings demotion did not come as a surprise. S.&P. put the company on notice in February, shortly after oil prices had collapsed to below $30 a barrel, vaulting much of the industry on the verge of bankruptcy. Pressures have eased somewhat since then as oil prices have bounced back by about 60 percent. Nevertheless, few analysts project that oil prices will recover to their 2014 levels of over $100 a barrel — well over double the current price — any time before 2020. A glut of natural gas on domestic and international markets has also trimmed Exxon Mobil’s revenue.

The company reported in the fourth quarter. It will report its first-quarter results on Friday.

The company’s saving grace has been its refinery and chemical industries, which benefit from the low oil and gas input costs.

Analysts are divided about which way oil and natural gas prices will go in the coming months, though most see a firming to more normal levels sometime next year. Crude and gas inventories are bulging around much of the world, and Iran’s oil exports continue to increase as it receives relief from nuclear sanctions. Few oil and natural gas wells are profitable to drill at today’s prices.

The ratings agency explained that it made its decision based on the company’s cash flow and debt levels, saying that the ratio between the two was inadequate to sustain the AAA rating.

It noted that the “company’s debt level has more than doubled in recent years, reflecting high capital spending on major projects in a high commodity price environment and dividends and share repurchases that substantially exceeded internally generated cash flow.”

“In our view, the company’s greatest business challenge is replacing its ongoing production,” S.&P. added.

While it complimented Exxon Mobil’s traditional fiscal prudence, the ratings agency warned that it could lower the company’s rating further if it was incapable of adapting to a persistent period of low oil and natural gas prices.

The ratings agency pointedly raised questions about the company’s decision to spend $54 billion on stock buybacks since 2012 while its debt load was ballooning. That cash could have been used to pay down debt, critics have noted.

S.&P. also noted that while the company was currently reducing capital spending, it will ultimately need to spend more to maintain levels of production and replace reserves from aging oil and gas fields.

Exxon Mobil officers said the rating cut would make little difference to the company.

“Nothing has changed in terms of the company’s financial philosophy or prudent management of its balance sheet,” said Scott J. Silvestri, a spokesman. “Exxon Mobil’s access to financial markets on attractive terms remains strong and is a competitive advantage to industry peers.”

Wall Street analysts also did not react to the news with alarm, saying the low oil and natural gas prices made the move inevitable.

“In the grand scheme of things I don’t think it matters that much,” said Philip H. Weiss, chief investment analyst at Baltimore Washington Financial Advisors. “If Exxon needs to raise some cash it might cost them a little bit more, but it’s not going to keep them from getting the money.”