WASHINGTON — The U.S. trade deficit widened in May to its highest level in six months as a sluggish global economy depressed U.S. exports. Fewer exports mean U.S. growth in the April-June quarter could be weaker than previously forecast.

The trade deficit rose to $45 billion in May, up 12.1 percent from $40.1 billion in April, the Commerce Department said Wednesday. It was the largest trade gap since November.

Exports slipped 0.3 percent to $187.1 billion. Sales of American farm products dropped to their lowest point in more than two years. U.S. exports have been hurt by recessions in many European countries.

Imports rose 1.9 percent to $232.1 billion. Imports of autos and other nonpetroleum products hit an all-time high.

The U.S. trade deficit is running at an annual rate of $501.2 billion, 6.3 percent lower than last year's gap.

A trade gap can restrain growth because it means consumers and businesses are spending more on foreign goods than companies are taking in from overseas sales.

Paul Dales, senior U.S. economist at Capital Economics, said the larger trade gap for May indicates that economic growth last quarter could be even weaker than the sluggish 1.5 percent annual rate he had previously predicted.

Economists at Barclays said the higher deficit had led them to downgrade their growth forecast for the second quarter from 1.6 percent to 1 percent.

The U.S. economy expanded at only a 1.8 percent annual rate in the first three months of the year, the Commerce Department said last week. That was much slower than its previous estimate of a 2.4 percent rate.

Economists say they think growth will rebound somewhat in the second half of this year as the effect of government spending cuts and tax increases begins to wear off.

For May, exports to the 27-nation European Union were up 6.4 percent. But over the past five months, exports to this region have declined 6.3 percent from the same period in 2012. Europe has been hurt by a prolonged debt crisis, which has led to recessions across the continent.

The U.S. deficit with China jumped 15.6 percent to $27.9 billion in May. That's close to the all-time monthly high set in November. So far this year, the U.S. deficit with China, the largest with any country, is running 3 percent higher than last year.

The United States and China will hold high-level talks in Washington next week. They will seek to resolve differences in such areas as cyber-security, theft of intellectual property and China's currency policies. U.S. manufacturers contend that China is manipulating its currency to gain trade advantages.

Imports of foreign-made autos and auto parts jumped 3.1 percent to a record of $26 billion in May. Petroleum imports surged 4.4 percent to $30.9 billion.

Exports of U.S.-made autos and auto parts also set a record in May of $13.1 billion. But exports of farm products fell to $9.8 billion, the lowest level since September 2010. Shipments of wheat, soybeans and corn were all down.

Slower growth overseas has weighed on U.S. manufacturing this year. But reports show that factories are starting to see some improvement.

The Institute for Supply Management said manufacturing activity grew in June after shrinking in April. And the Commerce Department said orders to U.S. factories rose in May, lifted by the third straight month of stronger business investment.

A housing recovery and steady job growth have helped offset the weakness in manufacturing. And the Federal Reserve said last month that it expects growth to strengthen in the next year.

Chairman Ben Bernanke said the Fed could scale back its bond buying later this year and end it next year if the economy continued to strengthen. His comments sent stocks falling, and the yield on the 10-year Treasury bond jumped.

Stocks have since rebounded and the yield on the 10-year Treasury note has dipped since the middle of last week. Favorable reports on the U.S. economy have helped.

And several Fed members have clarified that any tapering of the Fed's bond buying would hinge on economic improvement, not a calendar date.