Deputy Foreign Minister Hossein Amir-Abdollahian said such allegations were "made up as the result of the ill will of the enemies of the two countries' good relations", Iranian state television reported.
"Iran and Nigeria have friendly and close relations and despite the vast efforts of the two countries' enemies in recent years relations and cooperations have always improved," he said.
Nigeria's secret service said on Thursday it had arrested Abdullahi Mustapha Berende and two other Nigerians in December after Berende made several suspicious trips to Iran, where he interacted with Iranians in a "high-profile terrorist network".
It said Berende and his Iranian handlers were involved in "grievous crimes" against Nigeria's national security.
Berende, who will now be charged in court, told reporters at the Nigerian secret service's headquarters on Wednesday that he had carried out surveillance for the Iranians.
In 2004, Israeli sources said an Iranian diplomat was arrested on suspicion of spying on the Israeli embassy in Nigeria's capital Abuja. Tehran denied any arrest.
In 2010, authorities at a Lagos port found a hidden shipment of rockets, rifle rounds and other weapons from Iran, supposedly bound for Gambia. A Nigerian and an Iranian face criminal charges over the shipment.
Iran accuses Israeli and Western agents of sabotaging its disputed nuclear program and assassinating several of its scientists. Tehran has resisted Western pressure to curb its uranium enrichment activities, but is due to hold more talks on the issue with major powers in Kazakhstan on February 26.
Nigeria's 160 million people are split roughly equally between a mostly Muslim north and a largely Christian south.
Islamist groups in the north have become the biggest threat to stability in Africa's top oil producer. Western governments are increasingly concerned they are linking up with militants outside Nigeria, including al Qaeda's north African wing.
(Reporting by Zahra Hosseinian; Editing by Alistair Lyon)