WASHINGTON — The U.S. trade deficit rose for the sixth straight month in February, reaching the highest level since October 2008 and defying President Donald 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 $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, he 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.

On Tuesday, the U.S. proposed slapping tariffs on $50 billion in Chinese imports, and Beijing responded within hours with plans to tax $50 billion in American products, including soybeans and small aircraft. The two countries have signaled that they will seek to settle their differences before the tariffs take effect.

The president views trade deficits as a sign of economic weakness and as the result of bad trade agreements and unfair practices by America’s trading partners. Most economists say they are caused by bigger economic forces, mainly the fact that the United States consistently spends more than it produces.

The trade gap has continued to rise since Trump entered the White House partly because the U.S. economy is strong and American consumers have an appetite for imported products and the confidence and financial wherewithal to buy them.

____

Follow Paul Wiseman on Twitter at https://twitter.com/PaulWisemanAP