If President Trump follows through on his threat to impose an escalating tariff on all imports from Mexico, the impact on California’s economy would be huge.

Mexico sent $44 billion worth of goods to California last year, according to U.S. Census Bureau data, with transportation equipment, computer gear, agricultural goods and motor vehicles leading the way. Only Texas and Michigan import more from Mexico.

“This could get really ugly, really quickly,” said Christopher Thornberg, a principal at Los Angeles consulting firm Beacon Economics.

Trump said the tariffs would start at 5% on June 10 and rise to 25% by October unless Mexico stems the number of immigrants coming across the southern border.

Although the proposed tariffs would apply to imports, it’s likely that Mexico will retaliate with its own tariffs on U.S. exports.

“This will be particularly bad for California,” said Sen. Dianne Feinstein, D-Calif., in a statement. “Mexico is the top market for California exports, accounting for 17% of our state’s exports. The president’s plan is unnecessary, disruptive and chaotic. It invites a response from Mexico that will inevitably lead to a trade war.”

The value of California’s exports to Mexico has risen more than 20% over four years, to $30.7 billion in 2018, according to the California Chamber of Commerce.

The biggest component is computer equipment. California technology exports to Mexico, which include semiconductors and electronics, and audio-visual equipment, totaled $7.9 billion in 2018, up nearly 50% from 2014, according to an analysis of federal trade data by CompTIA, an information technology association.

The state also exports dairy products, nuts, fruits and grains to Mexico, said Sung Sohn, an economics professor at Loyola Marymount University, who predicted that farmers will be hard hit.

“Over 565,500 jobs in California depend on trade with Mexico,” Lenny Mendonca, Gov. Gavin Newsom’s chief economic and business adviser and head of the state’s Office of Business and Economic Development, said in a statement.

In addition to potentially imposing tariffs, Mexico could lose purchasing power. “The peso is now plunging” on the tariff news, Thornberg said. “If there’s a weaker peso, Mexicans can’t buy as much stuff from us.”

Mexico is a major source of produce, especially in the winter, when California farms take a break.

“I think it’d be a disaster for agriculture in general,” said Ken Christopher, executive vice president at Gilroy’s Christopher Ranch, the nation’s largest garlic grower. “In a world where supply goes down, demand is going to stay the same, so that just means higher prices for all Americans.”

Avocados, for instance, could wind up costing an extra nickel per pound for distributors with a 5% tariff, said Will Brokaw, co-owner of Brokaw Ranch, a Ventura County farm that grows avocados and other fruits.

Mexico accounted for about 78% of the U.S. avocado market last year, almost 2 billion pounds, according to the Hass Avocado Board. California growers accounted for 12% of the market.

Restaurant prices will see more moderate increases. Food costs account for 32 percent of restaurant prices, according to a study by the National Restaurant Association and Deloitte, and increases in individual ingredient costs aren’t always passed on.

The bigger risk for consumers would be decreased shipments from Mexican avocado growers in response to tariffs, which could push prices higher, Brokaw said.

California avocado farmers could benefit in the short term if prices rise and less produce arrives from Mexico. “The value of our fruit would go up,” said Brokaw. But in the long term, he said, people might turn away from avocados as prices rise.

Shoppers could soon face higher prices at supermarkets and other stores.

“Tariffs are a tax on American consumers; they are the ones who will feel the impact of this move,” said Andy Harig, senior director of sustainability, tax and trade at Food Marketing Institute, a trade group for about 1,000 food retailers and wholesalers, including most major grocery chains.

The tech industry said the impact could be devastating. Mexico bought $41 billion of U.S. consumer tech goods in 2017, making it by far the industry’s top export market.

“This is a short-sighted, short-tempered reaction that doesn’t recognize a basic economic fact — tariffs are taxes,” said Gary Shapiro, CEO of the Consumer Technology Association, in a statement.

California and the U.S. have an integrated supply chain with Mexico, with computer components, car parts and other components made in America and sent to Mexico for assembling. “Throwing tariffs on that is potentially far more serious to our economy than the situation with China,” said Thornberg of Beacon Economics.

The tariffs could also hit the U.S. medical device industry, nearly a fifth of which is based in California. It could particularly affect companies such as Sunnyvale’s Intuitive Surgical, which makes the da Vinci robotic surgery system and manufactures most of its instruments in Mexico. It did not immediately reply to request for comment Friday, but said in recent regulatory filings that tariffs and other foreign trade policies could hurt its profit margins.

Hospitals, one of the largest purchasers of medical devices and instruments, would also be hit. However, individual consumers would largely be spared since most instruments the tariffs would apply to are not paid for by patients because they’re used in surgical procedures.

For the Port of Oakland, the tariffs would have less consequence. Mexico accounts for only about 1% of all trade at the port, since most is with Asian countries. Last year, the port handled $530 million in imports from Mexico and $27.9 million in exports to it.

“Mexico tariffs would have negligible impact on Oakland port volume,” said Mike Zampa, a Port of Oakland spokesman, in an email.

Stocks fell Friday, capping off the worst month on Wall Street this year. Besides the immediate market turmoil, the tariff plan also throws into doubt the U.S.-Mexico-Canada Agreement, a negotiated replacement of the North American Free Trade Agreement.

The Dow Jones industrial average was down 1.4%, dropping below 25,000 for the first time in four months. The S&P 500 fell 1.3% and the Nasdaq lost 1.5%.

The Mexican peso fell 2.5% against the dollar.

The falling peso could help U.S. consumers, according to Thornberg of Beacon Economics: It might partially compensate for the tariff costs, so the price of goods imported from Mexico doesn’t spike.

Chronicle staff writers Kate Galbraith. Catherine Ho and Sophia Kunthara contributed to this report.

Carolyn Said and Roland Li are San Francisco Chronicle staff writers. Email: csaid@sfchronicle.com, roland.li@sfchronicle.com Twitter: @csaid, @rolandlisf