WASHINGTON — The U.S. trade deficit rose for the sixth straight month in February, reaching the highest level since October 2008 and defying President Trump’s efforts to rebalance America’s lopsided trade with the rest of the world.

The Commerce Department said Thursday that the trade gap – the difference between what America sells and what it buys in foreign markets – widened to $57.6 billion in February from $56.7 billion in January. Exports of goods and services hit a record $204.4 billion; imports set a record $262 billion.

The news comes amid a U.S. trade dispute with China that has rattled global financial markets and raised fears among U.S. farmers and businesses that depend on access to the Chinese market. The trade deficit in goods with China narrowed in February to $29.3 billion from $36 billion in January.

The United States ran a $77 billion deficit in the trade of goods in February, the highest level since July 2008. That was partially offset by a $19.4 billion surplus in services such as education and banking, lowest since December 2012. The services surplus was dragged down by $1 billion in payments for broadcast rights for the 2018 Pyeongchang Winter Olympics, which count as a services import.

Exports of cars and auto parts posted big increases in February as did imports of pharmaceuticals, crude oil and civilian aircraft.

Trump campaigned on a pledge to take aggressive action to reduce America’s massive trade deficits.

In March, the president slapped tariffs on imported steel and aluminum but exempted most major countries except China and Japan.

China counterpunched this week with tariffs on $3 billion in U.S. products.