BEIJING—U.S. Defense Secretary Jim Mattis met Wednesday with Chinese President Xi Jinping in an attempt to find common ground on security issues, but appeared to agree to disagree over the South China Sea.

The visit came as the Trump administration signaled Wednesday that the U.S. wouldn’t harden its position in the burgeoning economic conflict between the U.S. and China. The subject of trade came up briefly during Mr. Mattis’s visit, but aides said he aimed to keep the conversation focused on security issues and didn’t carry any particular message from Mr. Trump on trade.

Aides to Mr. Mattis described his meeting with Mr. Xi and other talks as positive and constructive, and aimed at expanding the military-to-military relationship. The meeting was part of a weeklong visit to Asia by the U.S. defense chief that will include stops in Seoul and Tokyo.

The talks spanned a range of issues that included Beijing’s concerns about Washington’s relationship with Taiwan, the self-ruled island that China also claims, as well as the denuclearization of North Korea and peace talks in Afghanistan.

The longstanding disagreement between the U.S. and China over Beijing’s militarization of the chain of islands in the South China Sea, not surprisingly, emerged as a top issue, said aides to Mr. Mattis, who was making his first visit to China as secretary.