Mattis accused China of having contempt for other nations' interests and disregarding international law.
He told the annual Shangri-La Dialogue in Singapore that the construction and militarization of artificial islands in the South China Sea undermined regional stability.
Chinese Foreign Ministry spokeswoman Hua Chunying said China's construction of facilities in the Spratly archipelago in the South China Sea was aimed at improving working conditions for people stationed there, maintaining sovereignty and fulfilling China's international responsibilities.
The sovereign activities undertaken by China had nothing to do with militarization, Hua said in remarks posted on the ministry's website late on Sunday.
China's claims in the South China Sea, through which about $5 trillion in ship-borne trade passes each year, are contested by Brunei, Malaysia, the Philippines, Taiwan and Vietnam. China and Japan both claim islands in the East China Sea.
Hua said countries around the South China Sea had tried to lower tensions, but others outside the region "have been bent on going against the trend, making repeated erroneous remarks, ignoring the facts and confusing black from white with entirely ulterior motives".
"China is resolutely opposed to this and urges the concerned parties to stop issuing irresponsible remarks and fully respect the efforts of the countries in the region to maintain peace and stability in the South China Sea and play a constructive role in this regard," she said.
Mattis said seeking China's cooperation on North Korea did not mean Washington would not challenge Beijing's activities in the South China Sea.
Last week, a U.S. Navy warship sailed within 12 nautical miles of an artificial island China has built on a disputed reef in the South China Sea, the first such challenge to Beijing since U.S. President Donald Trump took office.
The United States would continue "to fly, sail and operate wherever international law allows, and demonstrate resolve through operational presence in the South China Sea and beyond", Mattis said.
Hua said China had always respected freedom of navigation but opposed shows of military force in the South China Sea in the name of such exercises as threats to China's sovereignty and security.
The China Daily newspaper accused the United States of hypocrisy on Monday.
"U.S. President Donald Trump's decision to pull the U.S. out of the Paris climate change pact offers the latest example of how the U.S. disregards international agreements to suit its selfish and short-sighted needs," it said.