Exxon Mobil produced its weakest quarter in more than 16 years as lower oil prices pushed its profit down by 63 percent but still beat asnalysts’ expectations.

Revenue tumbled 28 percent, and the oil giant lost money in its vaunted exploration and production business despite a 2 percent increase in production. It made more money, however, in chemicals.

Exxon continued to slash capital spending to cope with lower prices, which this week cost the company the perfect AAA credit rating that it had held for more than six decades.

Exxon said Friday that it earned $1.81 billion in the first quarter, down from $4.94 billion a year ago. It was Exxon’s smallest quarterly profit since it earned $1.5 billion in the third quarter of 1999, according to FactSet figures.

On a per-share basis, the Irving, Texas-based company said it earned 43 cents per share, which beat Wall Street expectations. Nine analysts surveyed by Zacks Investment Research and 20 analysts surveyed by FactSet had forecast an average of 31 cents per share.

Revenue fell to $48.71 billion but topped forecasts. The FactSet analysts expected $44.75 billion.

The company lost $76 million in its exploration and production business because of an $832 million loss in the U.S. A year ago, the so-called upstream business earned about $2.9 billion on a much smaller U.S. loss of $52 million.

Exxon’s refining and fuels-marketing business was profitable, but not as much as a year ago partially due to weaker margins on refining.

The chemical business, however, earned $1.4 billion, an improvement of $373 million over the same period last year.

Exxon cut capital spending 33 percent to $5.1 billion from from the first quarter of 2015.