(Repeats to fix formatting)
WASHINGTON, July 6 (Reuters) - The U.S. trade deficit fell in May as exports increased to their highest level in just over two years, but trade could still weigh on economic growth in the second quarter.
The Commerce Department said on Thursday the trade gap decreased 2.3 percent to $46.5 billion. April's trade deficit was unrevised at $47.6 billion. Economists polled by Reuters had forecast the trade gap falling to $46.2 billion in May.
When adjusted for inflation, the trade deficit narrowed to $62.8 billion from $63.8 billion in April. Real goods exports surged to an all-time high in May, propelled by record high petroleum exports.
Still, the real trade deficit averaged $63.3 billion in April and May, above the first quarter's average of $62.2 billion. That suggests trade will be a drag on gross domestic product in the second quarter after contributing 0.23 percentage point to the economy's 1.4 percent annualized growth pace in the first three months of the year.
The Atlanta Federal Reserve is forecasting GDP rising at a 3.0 percent rate in the second quarter.
In May, exports of goods and services rose 0.4 percent to $192.0 billion, the highest level since April 2015, lifted by a surge in exports of consumer goods such as cell phones and other household goods.
There were also increases in exports of motor vehicles and parts. Food exports, however, fell by $0.7 billion amid a $0.6 billion drop in soybean shipments. Exports to China increased 3.6 percent. The value of goods shipped to Mexico and Canada rose 5.4 percent and 9.6 percent, respectively.
Exports to Germany gained 7.4 percent.
Imports of goods and services dipped 0.1 percent to $238.5 billion in May. Cell phone and other household goods imports fell $0.9 billion, accounting for the bulk of the $1.5 billion decrease in consumer goods imports.
There were also declines in imports of motor vehicles and parts. However, imports of capital goods increase $1.3 billion.
The country imported 265 million barrels of oil in May, the most since August 2012. Imports of goods from China increased 11.6 percent. The politically sensitive U.S.-China trade deficit increased 14.4 percent to $31.6 billion in May.
The trade gap with Mexico surged 15.8 percent to $7.3 billion, the highest since October 2007. (Reporting by Lucia Mutikani; Editing by Andrea Ricci)