WASHINGTON — President Donald Trump brought the world’s two biggest economies to the brink of a trade war Friday by announcing a 25 percent tariff on up to $50 billion in Chinese imports to take effect July 6.

Beijing quickly responded that it would retaliate with penalties of the same scale on American goods — and it spelled out details to impose tariffs on 545 U.S. exports, including farm products, autos and seafood, according to a report in The Wall Street Journal.

In announcing the U.S. tariffs, Trump said he was fulfilling a campaign pledge to crack down on what he contends are China’s unfair trade practices and its efforts to undermine U.S. technology and intellectual property.

“We have the great brain power in Silicon Valley, and China and others steal those secrets,” Trump said on “Fox & Friends.” “We’re going to protect those secrets. Those are crown jewels for this country.”

The prospect of a U.S.-China trade war rattled financial markets Friday. The Dow Jones industrial average closed down 84.83 at 25,090.48. Industrials had fallen by 220 points in midafternoon trading. Other stock averages also dropped.

The U.S. tariffs will cover 1,102 Chinese product lines worth about $50 billion a year. Included are 818 items, worth $34 billion a year, from a list of 1,333 the administration had released in April.

After receiving public comment, the U.S. removed 515 product lines from the list, including TVs and some pharmaceuticals, according to a senior administration official who briefed reporters on condition of anonymity.

The administration is targeting an additional 284 Chinese products, which it says benefit from Beijing’s strong-armed industrial policies, worth $16 billion a year.

But it won’t impose those tariffs until it gathers public comments. U.S. companies that rely on the targeted imports — and can’t find substitutes — can apply for exemptions from the tariffs.

The Trump administration has sought to protect consumers from a direct impact from the tariffs, which amount to a tax on imports. The tariffs target mainly Chinese industrial machinery, aerospace parts and communications technology, while sparing such consumer goods as smartphones, TVs, toys and clothes that Americans buy by the truckload from China.

These tariffs will impose higher costs on U.S. companies that use the equipment. Those costs could be passed on to consumers.

But the impact won’t be as visible as it would be if consumer products were taxed directly.

The administration characterized the tariffs it announced Friday as proper.

“It’s thorough, it’s moderate, it’s appropriate,” U.S. Trade Representative Robert Lighthizer said on Fox Business Network’s “Mornings With Maria.”

“Our hope is that it doesn’t lead to a rash reaction from China,” Lighthizer said.

But Beijing’s Commerce Ministry retorted in a statement: “The Chinese side doesn’t want to fight a trade war, but facing the shortsightedness of the U.S. side, China has to fight back strongly. We will immediately introduce the same scale and equal taxation measures, and all economic and trade achievements reached by the two sides will be invalidated.”

The U.S. tariffs are a response to China’s attempts to supplant U.S. technological dominance, including outright theft of trade secrets and its requirement that U.S. companies share technology in exchange for access to the Chinese market.

Political reactions to Friday’s announced tariffs cut across party lines. Senate Minority Leader Chuck Schumer, D-N.Y., said Trump was “right on target.”

But Rep. Dave Reichert, R-Wash., said he disagreed with the action because “Americans will bear the brunt instead of China.”