The US faced “growing threats from revisionist powers as different as China and Russia”, he said, unveiling the national defence strategy, BBC reported on Friday.
In an apparent reference to Russia, he warned against “threaten(ing) America’s experiment in democracy”.
“If you challenge us, it will be your longest and worst day,” he warned.
The US has been gripped by ongoing investigations into alleged collusion between the Trump 2016 election campaign and Russia.
Speaking in Washington, Mattis also appealed to Congress to fund the military adequately and refrain from “indiscriminate and automatic cuts” to the US federal budget.
US President Donald Trump is seeking to boost defence spending by 10 per cent, or $54 billion, in his proposed budget plan for this year, and hopes to recoup that sum through deep cuts elsewhere, including to foreign aid.