But Mr. Trump appeared to soften, saying he has “second thoughts about everything.” White House officials said he meant he should have acted even more forcefully against China.

Analysis: Experts say that Mr. Trump does, in fact, have the authority to pressure companies to pull out of China, but that doing so would be both destructive and impractical.

G7 updates: Mr. Trump praised the new British prime minister, Boris Johnson, calling him “the right man” for Brexit and promising a “very big trade deal” with the U.S.

Mr. Trump and Shinzo Abe, Japan’s prime minister, said they were near a trade deal.

Iran’s foreign minister, Mohammad Javad Zarif, made a surprise visit, at the invitation of France.

G7 leaders appeared to be nearing an agreement on fighting the fires in Brazil’s Amazon rain forest. Follow our live coverage of the G7.