The message boasted the hackers controlled the internet
A group calling itself the Iranian Cyber Army has hacked Twitter and an Iranian opposition website, replacing it with an anti-American message.
Traffic to the social networking website was redirected for nearly two hours on Thursday night.
The opposition website mowjcamp.org remained disrupted on Friday.
The opposition in Iran have used the websites to publicise protests and accuse the government of rigging elections in June.
"This site has been hacked by the Iranian Cyber Army," the message read.
The message, written in confused English, said the hackers had turned the tables on the US, who they criticise for sanctions on Iran.
"USA think they controlling and managing internet by their access, but they don't, we control and manage internet by our power," the message continued.
It ended on a seemingly polite note, telling visitors to "take care", and the hackers added a winking emoticon.
The hackers left an e-mail address, but could not be reached for comment.
Reporting on the hack, technology website techcrunch.com recommended that Twitter users who have the same password for other websites like Facebook or their email should change them.
Twitter posted a blog on their website saying the micro-blogging service had been restored an hour and a quarter after the hack was first noticed.
The post said the hackers had gained access to the inner workings of the site and redirected visitors to their own website.
The website Mowjcamp.org is run by supporters of the reformist candidates who challenged Iranian president Mahmoud Ahmadinejad in June's elections.
Both Twitter and Mowjcamp.org became a focal point for protesters during mass opposition rallies on the streets of Tehran, and the hundreds of arrests that followed.
Protesting Iranians posted pictures of the rallies, and the reaction of the Iranian riot police and pro-government militia, on the sites.
Opposition leaders Mir Hossein Mousavi and Mehdi Karroubi have said elections in June were rigged against them.