The sentence, issued by the Revolutionary Court and confirmed by Iran's Supreme Court, was carried out in Tehran at 6:30 am (0300 GMT) on Sunday and before "a crowd of nearly three hundred people", ISNA said.
It said the two, identified as Alireza Mafiha and Mohammad Ali Sorouri, both aged under 24, were convicted of Moharebeh (waging war against God) and corruption on earth.
Under Iran's interpretation of Islamic sharia law using firearms or knives and clubs in a crime are considered as Moharebeh, whose punishment is death sentence.
The men were arrested along with two other accomplices last month after the YouTube video footage showed them assaulting a man, and robbing him of his money, bag and coat.
Posted on December 6, the video was also shown on state television.
The footage shows the four men arriving on motorbikes and then two attacking the victim with one leading the assault with a machete, before riding off.
ISNA said the two other accomplices involved in the attack were "sentenced to 10 years in prison, 74 lashes and five years in exile."
Following the attack, Iran's judiciary promised to take a harsher stance on thugs, saying the incident had "caused insecurity."
Iran, where murder, rape, armed robbery, drug trafficking and adultery are also punishable by death, is among countries with the highest annual record of executions in the world, along with China, Saudi Arabia and the United States.
Human rights watchdog Amnesty International has condemned the executions, but Tehran says the death penalty is essential to maintain law and order and that it is enforced only after exhaustive judicial proceedings.