The U.S. trade deficit narrowed by nearly 9 percent in July, the Commerce Department reported yesterday -- but at $50.1 billion, the gap was still the second-largest on record.

The decline in the monthly deficit, driven in part by a surge in exports of U.S. autos, computers and aircraft, was announced a day after Federal Reserve Chairman Alan Greenspan said he believed a U.S. economic recovery was gaining "traction."

At the same time, the Labor Department reported yesterday that the prices paid to farms, factories and other producers fell by 0.1 percent in August, a sign inflation remains controlled.

The decrease in the trade deficit stemmed from a 3 percent rise in exports, to $95.9 billion, and a drop in the value of foreign oil shipments that helped lower the nation's imports by 1.4 percent, to $146 billion.

Though that's an improvement over June's record $55 billion trade gap, analysts took small comfort in figures showing the second consecutive deficit above $50 billion. Only last year did the monthly gap regularly exceed $40 billion, and it has so far defied predictions it would subside.

"Yes, we're off the big record high, but clearly you still have some major issues with these numbers," said John E. Silvia, chief economist at Wachovia Corp.

"Over the past year, we're looking at a pattern of deterioration in trade, and this report doesn't change that," said William C. Dudley, chief economist at Goldman Sachs & Co., adding that the combined results for June and July "tell you the dollar hasn't declined enough to generate an improvement."

The reference to the dollar pinpoints the problem that most worries economists about the trade deficit -- the danger that it will cause a deep decline in the dollar, eroding U.S. living standards or, even worse, triggering a serious financial crisis.

Over the past several years, the U.S. dollar has fallen significantly against the euro, the Canadian dollar and several other major currencies, and since a cheaper greenback makes U.S. goods more competitive on world markets, that should help boost exports and curtail imports. But so far, that hasn't happened at a fast enough rate to shrink the trade deficit, which, based on data through July, is running at an annual rate of $581 billion, well above last year's all-time high of $496.5 billion.

With the trade gap remaining stubbornly high, the United States in effect has to borrow from foreigners to pay for much of its huge import bill, as foreigners receiving dollars for the goods they ship to the United States invest that money mostly in U.S. Treasury bonds. If foreign investors suddenly decide to unload their giant Treasury bond holdings, that could drive interest rates sharply higher and send financial markets into a tailspin. And even if that doesn't happen, many experts expect that until the trade deficit narrows substantially the dollar will continue to fall over the long term, which will affect the living standards of U.S. consumers by increasing the cost of imported cars, clothes and other products.

"I don't know that I would stay up late at night worrying about it, but as [former chief White House economist] Herb Stein used to say, 'Trends that are unsustainable must end,' " Dudley said. "So something has to come along to change this [trade deficit], and presumably a weaker dollar is going to be part of the story. Hopefully it will be gentle rather than precipitous, but we can only cross our fingers."

The trade figures have also become an issue in this year's election. Democratic presidential nominee Sen. John F. Kerry (Mass.) has used the data to bolster his case that the Bush administration isn't moving aggressively enough to protect American workers against unfair practices by U.S. trading partners. Administration officials have countered that the deficit is paradoxically a symbol of the United States' economic success, because it reflects faster U.S. growth relative to other countries, which causes imports to surge more rapidly than exports.

Kerry seized on yesterday's news to highlight the politically sensitive U.S. deficit with China, which hit another monthly record of $14.9 billion.

"One day after George Bush refused to crack down on China's illegal currency manipulation, we learn that our trade deficit with China has set a new record, jumping 28 percent in the last year," Kerry said in a statement. The statement was referring to the administration's rejection Thursday of a petition filed by labor and industry groups for a more confrontational U.S. stance against China's fixed-rate currency, which allegedly makes Chinese goods artificially cheap.