He called his visit to the USS Theodore Roosevelt "a symbol" of America's stabilising presence in the region.
Mr Carter said any concern over his visit was due to "tension in this part of the world", blaming China for "most of the activity over the last year".
His visit clearly irritated Beijing, a BBC correspondent in China says.
A Chinese foreign ministry spokeswoman warned against "waving the banner of freedom of navigation to push forward the militarisation of the South China Sea and even provoke and endanger other countries' sovereignty and security interests".
"In this aspect, we hope the relevant actions and intentions of the US can be made open and above board," she said before Mr Carter's visit.
The US defence secretary flew on Thursday with his Malaysian counterpart to the Theodore Roosevelt, which was sailing some 70 miles (112 miles) north-west of Borneo.
His visit comes a week after a US Navy destroyer sailed inside the 12 nautical mile radius that China claims as its territorial waters around one of its recently reclaimed islands.
Countries in and around the South China Sea have wrangled for centuries over control of the ocean areas and its, largely uninhabited, islands.
But tensions have increased in recent years as China has backed its expansive claims with island-building and navy patrols.
The US alleges China has reclaimed almost 3,000 acres of land in the past 18 months, and fears the dispute could turn into one with global consequences.
US defence secretary Ash Carter has visited an aircraft carrier in the South China Sea's contested waters, in what is seen as a signal to China.