WASHINGTON (AP) - The U.S. trade deficit increased in May to the highest level in six months as a weak global economy depressed U.S. export sales while imports of autos and other nonpetroleum products hit an all-time high. The trade deficit rose to $45 billion in May, up 12.1 percent from April's $40.1 billion imbalance, the Commerce Department reported Wednesday. It was the largest trade gap since November. Exports slipped 0.3 percent to $187.1 billion as sales of American farm products dropped to the 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 with nonpetroleum imports hitting a record high. The trade deficit is running at an annual rate of $501.2 billion, 6.3 percent lower than last year's total of $534.7 billion. A wider trade gap can restrain growth because it means U.S. consumers and businesses are spending more on foreign goods than U.S. companies are taking in from overseas sales. But economists noted that the wider deficit does show growth in the United States remains stronger than most other nations. That growth has helped fuel more spending by consumers on domestic and imported goods. For May, exports to the 27-nation European Union were up 6.4 percent but over the past five months exports to this region are down 6.3 percent compared to the same period in 2012. Europe has been hurt by a prolonged debt crisis which has led to recessions in a number of countries. The U.S. deficit with China jumped 15.6 percent to $27.9 billion in May, close to the all-time monthly high set last 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, seeking to resolve differences in such areas as cyber-security, theft of intellectual property and China's currency policies. U.S. manufacturers contend 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 while petroleum imports were up 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 with shipments of wheat, soybeans and corn all down. Most economists say trade was likely neutral in the April-June quarter after subtracting slightly from growth in the January-March quarter. Economists expect economic growth remained tepid in the April-June quarter. But economists believe growth will rebound somewhat in the second half of this year as the impact of the spending cuts and tax increases begins to wear off. Slower growth overseas has weighed on U.S. manufacturing this year. But several reports show factories are starting to see some improvement. The Institute for Supply Management reported that manufacturing activity grew in June after shrinking in April. And the Commerce Department said orders to U.S. factories rose in May, helped 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 last month said that it expects growth to strengthen in the next year. Stocks have since rebounded and the yield on the 10-year Treasury note has dipped since the middle of last week.