With Americans no longer fighting in Iraq and the country preparing to pull out of Afghanistan, Obama said: "As today's wars end, our military -- and our Air Force -- will be leaner. But as commander in chief, I will not allow us to make the mistakes of the past."
The president said American still faces "very serious threats," including al-Qaida in Yemen.
"So we need you to be ready for the full range of threats from the conventional to the unconventional, from nations seeking weapons of mass destruction to the cell of terrorists planning the next attack, from the old danger of piracy to the new threat of cyber. We must be vigilant," Obama said.
"So, guided by our new defense strategy, we'll keep our military -- and our Air Force -- fast, flexible and versatile. We will maintain our military superiority in all areas -- air, land, sea, space and cyber."
Obama said the graduates arrived at the academy four years ago "at a time of great challenge for our nation."
He noted the military was fighting two wars at the time, al-Qaida was "entrenched" in safe havens, U.S. alliances were strained and the economy was in the worst recession since the Great Depression.
"Today," he said, "you step forward into a different world. You are the first class in nine years that will graduate into a world where there are no Americans fighting in Iraq. For the first time in your lives -- and thanks to Air Force personnel who did their part -- Osama bin Laden is no longer a threat to our country. We've put al-Qaida on the path to defeat. And you are the first graduates since 9/11 who can see clearly how we'll end the war in Afghanistan."
Obama said the 21st century would be a "great American century" and the country has the "resilience to make it through these tough economic times."
The country, he said, needs to "put America back to work by investing in the things that keep us competitive, including education and high-tech manufacturing, science and innovation, while paying down the deficit, reforming the tax code and continuing to reduce dependence on foreign oil.
Obama pointed to strong alliances with other countries and said the United States has mobilized dozens of nations to ensure nuclear weapons never fall into terrorists' hands and rallied countries to "put the strongest sanctions ever on Iran and North Korea, which cannot be allowed to threaten the world with nuclear weapons."
Obama also said "no other nation has made the advancement of human rights and dignity so central to its foreign policy. That's because it's central to who we are, as Americans. It's also in our self-interest, because democracies become our closest allies and partners."