Major General Qassem Soleimani vowed that if Mr Trump started a war, the Islamic Republic would end it, Iranian news agency Tasnim reported.
It follows Mr Trump's all-caps-lock tweet warning Iran's president to "never, ever" threaten the US.
Tensions have risen since the US withdrew from the 2015 Iran deal.
Maj Gen Soleimani - who leads the Quds Force of Iran's elite Revolutionary Guards - was quoted on Thursday as saying: "As a soldier, it is my duty to respond to your threats.
"Talk to me, not to the president [Hassan Rouhani]. It is not in our president's dignity to respond to you.
"We are near you, where you can't even imagine. Come. We are ready.
"If you begin the war, we will end the war. You know that this war will destroy all that you possess."
He also accused the US president of using the language of "night clubs and gambling halls".
On Sunday, Mr Trump tweeted a startling threat to Iran's president.
But two days later, while speaking to a veterans' group, the president said the US was "ready to make a real deal" with Iran.
Mr Trump's angry tweet was a response to a warning by Mr Rouhani to the US.
"America should know that peace with Iran is the mother of all peace, and war with Iran is the mother of all wars," he said earlier, according to Iran's state news agency Irna.
In May, Mr Trump announced that the US was withdrawing from the Obama-era nuclear agreement with Iran, going against advice from European allies.
Mr Trump had said the Iran deal was "defective to its core".
In response, Iran had said it was preparing to restart uranium enrichment, key for making both nuclear energy and weapons.
Washington is now re-imposing sanctions on Iran's oil, aircraft exports, and precious metals trade among other sectors, despite objections from the UK, France, China, Russia and Germany, who all signed the 2015 agreement.
But there are other flashpoints too. The US is deeply suspicious of Iranian activity in the Middle East and is aligned with Israel and Saudi Arabia, two of Iran's foes.
Iran has insisted that its nuclear programme is entirely peaceful and its compliance with the 2015 deal has been verified by the International Atomic Energy Agency.