WASHINGTON/HANOI (Reuters) - Vietnam has won the promise of a visit from a U.S. aircraft carrier and deeper defense cooperation from the United States as strains show with China over the disputed South China Sea.

Slideshow ( 3 images )

Within Southeast Asia, Vietnam has become an increasingly lonely voice in challenging Chinese claims to the vast majority of the waterway and was forced to suspend some offshore oil drilling last month after pressure from Beijing.

U.S. Defense Secretary Jim Mattis told Vietnamese counterpart Ngo Xuan Lich in Washington on Tuesday that a strong defense relationship was based on common interests that included freedom of navigation in the South China Sea.

“The Secretary welcomed Vietnam’s engagement and growing leadership in the Asia-Pacific region,” a statement from the Pentagon said.

The defense ministers agreed on a visit by a U.S. aircraft carrier to Vietnam next year - the first such visit since the Vietnam War ended in 1975. President Donald Trump discussed the possibility of a carrier visit with Vietnamese Prime Minister Nguyen Xuan Phuc when they met at the White House in May.

The agreement was consistent with Vietnam’s diplomatic strategy of being open to all countries, said Ha Hoang Hop, a Vietnamese political analyst who has advised the government.

“Vietnam is not willing to compromise on issues of sovereignty and also makes its own preparations,” he said.

Beijing has been irritated by Vietnam’s growing defense relationships with the United States and rival Asian powers, including Japan and India.

Tension has risen since June, when Vietnam infuriated China by drilling for oil and gas in an offshore block that Beijing disputes. The exploration was suspended after diplomatic protests from China.

China was also annoyed by Vietnam’s stand at an Association of South East Asian Nations (ASEAN) meeting at the weekend, when it held out for language in a communique that noted concern about island-building and militarization in the South China Sea.

A scheduled meeting between Chinese and Vietnamese foreign ministers on the sidelines of the summit was canceled. China also pointed to Vietnam’s own reclamation work in the South China Sea. [L4N1KU1JM]

Beijing is sensitive to even a veiled reference by ASEAN to its reclamation of seven reefs and its military installations in the South China Sea, which it claims in almost its entirety despite the competing claims of five other countries.

More than $3 trillion in cargo passes through the waterway every year.

Australia, Japan and the United States urged Southeast Asia and China on Monday to ensure that a South China Sea code of conduct they have committed to draw up would be legally binding and said they strongly opposed “coercive unilateral actions”.[nL4N1KT320]