WASHINGTON — Rising exports and falling imports shrank the United States’ trade deficit in goods and services to the lowest level in nearly a year, data released Thursday by the Commerce Department showed.

The trade deficit — the gap between what the United States imports and what it exports — narrowed to $42.4 billion in August, down $1.2 billion from July. Exports for the month were $195.3 billion, while imports came to $237.7 billion. The nation’s trade deficits with China and the European Union both shrank in August.

Josh Feinman, the chief economist of Deutsche Asset Management, said those trends were largely the result of a strengthening global economy that buoyed American exports, as well as the weakening of the value of the dollar.

“Global growth is looking better,” Mr. Feinman said. “That does create a little bit of a tailwind for exports.” He cautioned that the economic impact of Hurricane Harvey, which made landfall in Texas on Aug. 25, could be distorting the data somewhat, as ports closed and people stayed home from work and shops.

Despite the narrowing in August, the overall trade deficit is still growing on an annual basis. It was up 8.8 percent in the first eight months from the same period in 2016, according to Commerce Department data.

President Trump has often pointed to the trade deficit as evidence that the United States is not benefiting from global trade in the way that it should. He has promised that his America-first policy will help shrink the gap, consistently citing deficits with other countries as a sign that the United States is losing when it comes to global trade. And he has typically blamed trade agreements and negotiators for failing to achieve the best terms for American exporters.

The administration has commissioned a comprehensive report on the state of significant trade deficits, which has not yet been released to the public.

Economists caution against reading too much into the trade deficit, particularly monthly swings, as a measure of the administration’s success in giving America the economic upper hand. That’s because the trade deficit is closely linked with multiple macroeconomic factors including like the relative growth rates of countries, the value of currencies, the strength of the dollar as a global reserve currency, and global trends in savings and investment.

A better measure of success for Mr. Trump’s America-first policy, economists say, would be putting more Americans to work, and rising growth and productivity gains over all.

In an emailed response, Wilbur Ross, the secretary of commerce, said such macroeconomic factors did not explain the huge increase in the trade deficits the United States has seen with other countries in the past: China immediately after its admission to the World Trade Organization, Mexico after the North American Free Trade Agreement was signed or South Korea after the United States signed a trade deal with that country.

“China’s trade surplus is what has fueled their economic growth for many years,” he wrote. “If a trade surplus is good for China how can a trade deficit be anything but bad for us?”

Many economists do not see the trade gap as a negative. Bryan Riley, an economist at the Heritage Foundation who supports free trade, said the trade deficit was not necessarily a sign of trouble but can be good or bad, depending on the circumstances. Mr. Riley pointed out that in recent years, the economy has grown faster when the trade deficit was getting bigger, and slower when it was getting smaller.

While the Trump administration would consider such tax changes to be a success, Mr. Riley said they could make the trade deficit even bigger — if, for example, lower taxes expand economic growth, giving Americans more money to buy goods from abroad, or encourage foreigners to invest more in the United States.

Not every economist thinks that a trade deficit is harmless. Some, especially those on the left, see persistent imbalances as a potentially troubling sign that the United States has lost manufacturing jobs to other countries.

Jared Bernstein, a senior fellow at Center on Budget and Policy Priorities and a former economic adviser to Vice President Joseph R. Biden, said that while the president should not look to trade deficits as a “scorecard” from month to month, Mr. Trump “was onto something” with his intuition that persistent trade deficits reflected a structural problem of fewer goods being produced in the United States.

But Mr. Bernstein agreed that it would be difficult for the president’s actions to have much influence on trade flows, which are determined by broader economic factors. He predicted that the country’s trade balance when Mr. Trump leaves office would be pretty similar to what it was when he came in. As powerful as the president and economic policy can be, they pale in comparison with millions of American consumers and producers — and the multinational supply chains that have long existed to serve those needs.

“Cargo ships aren’t going to disappear because of saber rattling,” Mr. Bernstein said. “You actually have to implement pretty drastic policies to disrupt these flows, which are embedded in the global economy. The things you’ve heard them talking about are pretty marginal.”

That seems unlikely to dissuade Mr. Trump from citing the metric. On Monday, he told Gen. Prayuth Chan-ocha, the prime minister of Thailand, that he wanted to reduce the trade deficit with that country. “I think we’re going to try and sell a little bit more to you now,” the president said.

Correction:

An earlier version of this article misstated part of the name of the organization where Bryan Riley is an economist. It is the Heritage Foundation, not the Heritage Institution.

A version of this article appears in print on , on Page B3 of the New York edition with the headline: U.S. Trade Deficit Shrank in August on Strength of Rising Exports. Order Reprints | Today’s Paper | Subscribe