It was the first major violence between security forces and demonstrators in three weeks in Iran, where tensions are still running high over President Mahmoud Ahmadinejad's disputed re-election last month.
Some of the estimated 2,000 people at the cemetery hurled stones at police and chanted slogans in support of main opposition leader Mir Hossein Mousavi who was forced to leave just minutes after his arrival, while police were surrounding fellow reformist Mehdi Karroubi, witnesses said.
"Today is a mourning day. Loyal Iranians are the mourners today," shouted the crowds at the Behesht-e Zahra cemetery south of Tehran.
Mourners were marking the religiously significant 40th day since the death of Neda Agha-Soltan, a young woman who came to symbolise the public protests over Ahmadinejad's June 12 victory.
Police who numbered around 150 used sticks, batons and belts against the crowds and arrested several mourners as Mousavi turned up, the witness said.
"Mousavi was however not allowed to recite the Koran verses said on such occasions and he was immediately surrounded by anti-riot police who led him to his car," a witness said as people chanted "Ya Hossein! Mir Hossein!".
Mousavi and Karroubi, who have waged a defiant protest campaign since losing to Ahmadinejad in what they brand a rigged election, had announced they would visit the cemetery after authorities banned another memorial ceremony.
Witnesses said dozens of policemen were also at the Grand Mosalla in Tehran, a venue used for religious functions where the opposition had planned to hold the ceremony.
A graphic Internet video of Neda bleeding to death on a Tehran street on June 20 was seen around the world and triggered an outcry over the Iranian crackdown on demonstrators.
About 40 people, wearing green wristbands and T-shirts -- the signature colour of Mousavi's election campaign -- were earlier seen standing around Neda's grave which was decorated with candles and flowers.
Mousavi, a prime minister in the post-revolution years who was Ahmadinejad's main challenger, has consistently refused to acknowledge his rival's victory, saying it was a "shameful fraud."
Hundreds of thousands of people poured on to the streets of Tehran after the election result and in the ensuing violence about 30 people were killed, scores wounded and several thousand arrested, Iranian officials say.
Karroubi's deputy Rasool Montajebnia suggested that Mousavi, former parliament speaker Karroubi and reformist former president Mohammad Khatami form a joint council to advance the opposition movement.
"If they individually carry out actions, it cannot become a comprehensive movement and address people's demands," he was quoted as saying by Karroubi's reformist newspaper Etemad Melli.
"There is no way but to establish a council of reform... around the axis of Khatami, Karroubi and Mousavi."
The election tumult has driven deep rifts between the nation's ruling elite and clerical groups, and Ahmadinejad has since come under fire even from his own hardline supporters over a series of controversial political decisions.
In recent days, the authorities have made gestures towards the opposition, including releasing about 140 protesters and promising to free more of the some 250 still behind bars.
But Khatami said just releasing the protesters was not enough.
"Blood has been spilled and several families are damaged psychologically. Illegal and un-Islamic acts have been committed against the people... crimes have been committed. Lives have been lost," he said on his Baran foundation website.
US Secretary of State Hillary Clinton on Wednesday said it was "imperative" for Iran to release political prisoners, adding that their detention showed "the political situation inside of Iran has not yet resolved itself."
Twenty people accused of rioting are to go on trial from Saturday on charges including attacks on government and military offices, arson, vandalism and contact with "enemies" including exiled opposition group the People's Mujahedeen.
Ahmadinejad is due to be sworn in next week but is facing harsh criticism from powerful conservatives who have warned him to obey supreme leader Ayatollah Ali Khamenei or face the consequences.