"These fine sailors have spent the last several years preparing to lead the United States Navy in both times of peace and crisis", Trump said. "A lot of things have happened, we're respected again". "We're respected again", the commander-in-chief said.
There were 1,042 graduates this year.
"Together you are the tip of the spear, the edge of the blade and the front of the shield defending and protecting our great country", Trump said.
At one point, the president made a vague reference to the Naval Academy's winning streak in the annual Army-Navy matchup, saying he didn't want to mention who won the game, but applauding the school's record of "winning".
"In recent years, and even decades, too many people have forgotten that truth".
"In every generation, there have been cynics and critics who try to tear down America".
"A growing number used their platforms to denigrate America's incredible heritage, challenge America's sovereignty and weaken America's pride", he said.
"We have become a lot stronger lately", Trump declared to wild applause, adding "We are not going to apologize for America". "We are not going to apologize for America, we are going to stand up for America". We are going to stand up for our values. "And when did we need it more than now?"
His speech came a day after he kicked up fears of ratcheting tensions on the Korean peninsula for canceling a diplomatic summit with North Korea's leader scheduled for next month.
On Twitter Friday, Trump said he looks "forward to being with some of the greatest people on earth!"
The president began his commencement address by praising the graduates' diligence and patriotism, in a speech that seemed to largely stick to the script.