BEIJING — Secretary of Defense Jim Mattis arrived Tuesday in Beijing in the first visit to China by a Pentagon chief in four years. It comes as Beijing and Washington navigate a burgeoning trade war and tensions related to the Chinese military’s buildup in the South China Sea.

Mr. Mattis has stressed a diplomatic approach to the trip, saying Sunday, “I’m going there to have a conversation.”

“I want to understand how they see the strategic relationship developing,” Mr. Mattis told reporters that day before the first stop of his trip, in Alaska. “And so I want to go in, right now, without basically poisoning the well at this point, as if my mind’s already made up.”

Still, less than a month ago he publicly accused China of “intimidation and coercion” for placing surface-to-air missiles and other military equipment on contested islands in the South China Sea. To varying degrees, the Philippines, Taiwan, Vietnam and Malaysia all stake claims to parts of the sea.