The address was a meaty rebuttal to Democrats who had expressed concern that Mrs. Clinton’s campaign lacked gumption in going after Mr. Trump, particularly because Mr. Obama and Senator Elizabeth Warren of Massachusetts have relished opportunities to skewer him.

By turns mocking and stern, Mrs. Clinton derided Mr. Trump for suggesting that Japan should acquire nuclear weapons to deter North Korea, that the United States should have walked away from the nuclear deal with Iran, and that “maybe Syria should be a free zone for ISIS.”

“He says he has foreign policy experience because he ran the Miss Universe pageant in Russia,” Mrs. Clinton said. “And to top it off, he believes America is weak. An embarrassment. He called our military a disaster. He said we are, and I quote, a ‘third-world country.’”

In vivid strokes, Mrs. Clinton framed not just her case against Mr. Trump but the broader foreign-policy debate in the election: She cast herself as the defender of an American-led world order against an insurgent who did not understand, let alone respect, the network of alliances the United States constructed after World War II to safeguard its interests.

Mrs. Clinton presented herself as a sure-footed commander in chief, a fervent believer in America as an exceptional country, tested by her time in the Situation Room. She highlighted her ability to go “toe to toe” with leaders in Beijing and Moscow, contrasting that with what she said was Mr. Trump’s “bizarre fascination with dictators and strongmen who have no love for America.”

“I’ll leave it to the psychiatrists to explain his affection for tyrants,” she said. “I just wonder how anyone could be so wrong about who America’s real friends are.”

Even as she excoriated Mr. Trump, Mrs. Clinton kept a close eye on domestic politics. She noted, for example, that she understood the deep qualms that voters had with trade deals. Still, Mr. Trump’s threats to impose tariffs on Chinese imports, Mrs. Clinton said, would set off a trade war of the kind that deepened the Great Depression in the 1930s.