His remarks in Tehran came a day after the Trump administration decided to reinstate all US sanctions on Iran removed under the 2015 nuclear deal.
"For 40 years, the challenge between America and Iran has continued and a variety of movements have taken place from the enemy's side – from the military and economic warfare to the media war launched by America,” he said, according to Press TV.
"The goal of the United States in all this was to regain the domination it had in the era of the tyranny, but it could not," the Leader said, referring to the period before the Islamic Revolution when the Shah of Iran was a close US ally.
Ayatollah Khamenei addressed thousands of students on the eve of the 1979 takeover of the US embassy in Tehran, which is marked every year with nationwide rallies.
"There is an important fact here, that in this 40-year-old challenge, the American side has been defeated and the side of the Islamic Republic has been victorious," the Leader said.
"The reason for America's defeat is that it has started the attack but has not reached its goals," he added.
The US sanctions take effect Monday and cover Iran’s shipping, financial and energy sectors. They are the second batch the Trump administration has re-imposed since he withdrew from the landmark accord in May.
Ayatollah Khamenei said, "America's goal with sanctions is to cripple and hold back Iran's economy, but the outcome is that the push toward self-sufficiency has expanded in the country."
"Over the years, the Iranian nation had become accustomed to importing everything, but now it is accustomed to seeking to produce everything," he added.
President Donald Trump, who unilaterally withdrew from the international nuclear agreement in May, tweeted after Friday's announcement, "Sanctions are coming."
Ayatollah Khamenei said US power and credibility is fast fading under President Trump "whose every decision is faced with opposition not only from people but even governments around the world."
"The new president of America has put everything up for auction and squandered the remaining credibility which America and liberal democracy had."
US ‘much weaker’ now
Ayatollah Khamenei said on Saturday America's power is in decline and the country is much weaker today than it was 40 years ago.
"Many acclaimed American politicians believe that America's soft war has been worn out," he said, adding "its hard power, namely America's economic and military power, is also declining."
"The US military is extremely confused and, therefore, it uses organizations such as Blackwater to advance its military objectives," he said, referring to a private military contractor which gained notoriety for its cold-blooded killing of civilians in Iraq and Afghanistan.
The US economy "is the same, with $15 trillion of debt and $800 billion of budget deficit," Ayatollah Khamenei added.
The Leader said one of the manifestations of the American defeat is that it has not been able to affect the spirit of independence among the Iranian youths.
"Our youths all over the country have pro-independence feelings; some of them do not even have a very religious commitment, but they are sensitive to foreign domination," he said.
These feelings, the Leader said, have gradually spread to other countries, especially Iran's neighbors.
"Of course, the United States sees some of these things down to us and threatens us, saying 'If the youth of such and such neighboring country attack our forces, we will hold you culpable'.
"Well, you're dead wrong to blame us! People in Iraq, Syria, Lebanon, Afghanistan and Pakistan hate you. What does this have to do with us?" Ayatollah Khamenei said.