WASHINGTON – The U.S. trade deficit fell in October, helped by America’s energy boom that lifted exports to an all-time high.

The trade gap narrowed to $40.6 billion in October, the Commerce Department said Wednesday. That’s 5.4 percent lower than the September gap of $43 billion, which was higher than initially estimated.

Exports rose by 1.8 percent, to a record $192.7 billion, buoyed by a 9.3 percent gain in petroleum exports. Imports rose by 0.4 percent, to $233.3 billion, the highest since March 2012. Oil imports rose by 1.5 percent.

The United States is being helped on the energy revival, which has lessened its dependence on foreign oil. U.S. petroleum exports are up by 9.3 percent from a year ago. At the same time, petroleum imports are down by 11.1 percent. The drop in oil imports has been helped by lower global prices.

A smaller trade deficit can boost economic growth. It typically shows that American companies are earning more from sales overseas, while U.S. consumers are buying fewer products from their foreign competitors.

Through October, the deficit is running 10.6 percent below last year’s pace. The deficit is smaller because exports have risen by 2.7 percent, while imports are basically running at the same pace as last year.

The overall economy grew at an annual rate of 2.8 percent in the July-September quarter. That figure will be revised today, and many analysts believe that growth will be boosted to a 3.1 percent rate.

However, much of the third-quarter strength came from a buildup in business stockpiles. Businesses are expected to have slowed inventory building in the final three months of the year. For that reason, many economists believe overall economic growth has decelerated to a 2 percent annual rate or less.

Trade is expected to add to U.S. economic growth in the final three months of the year, reflecting modest recoveries in Europe, Japan and China. Stronger global growth has helped drive more activity at U.S. factories.

A closely watched survey of U.S. manufacturing activity rose in November to the highest level in 2½ years.

And the Institute for Supply Management’s survey showed that growth in exports increased at the fastest pace in nearly two years.

In October, U.S. exports to the European Union rose by 1.5 percent. The U.S. trade deficit with the EU hit a monthly record of $14.3 billion in October, reflecting a 21.5 percent jump in exports.

America’s deficit with China narrowed slightly in October to $28.9 billion. U.S. exports to China hit a record at $13.1 billion.

However, that was a fraction of its imports from China, a record $41.9 billion.

The U.S. trade imbalance with China is the largest for any country.

That figure is up by 2.1 percent for the year and on track for another all-time high.

In an October report, the Obama administration said it still believed that China’s currency, the renminbi, was significantly undervalued, but it declined to label China a currency manipulator.

Such a designation would have triggered negotiations that could ultimately lead to U.S. trade sanctions against China.