By Samihullah Paiwand

GARDEZ Afghanistan (Reuters) - A car packed with explosives exploded on Tuesday as it sped through a crowded market in Afghanistan's eastern province of Paktika, killing at least 89 people, officials said, one of the most violent attacks in the country in a year.

The huge explosion took place not far from the porous border with Pakistan's North Waziristan region, where the military has been attacking hideouts of the Pakistani Taliban in the past few weeks, prompting militants to retreat toward Afghanistan.

"The number of victims may increase," said General Zahir Azimi, a defense ministry spokesman.

U.N. Secretary-General Ban Ki-moon condemned the attack as a "despicable criminal act," which was a serious violation of international law, his spokesman said.

The attack comes at an uneasy time in Afghanistan as the country recounts votes from a disputed presidential election which the Taliban have vowed to disrupt.

But the Taliban distanced themselves from Tuesday's attack. The movement's leaders have ordered militants not to target civilians.

"The truth behind this attack will become clear after an investigation, but we clearly announce that it was not done by the Mujahedeen of the Islamic Emirate of Afghanistan," Zabihullah Mujahid, a Taliban spokesman, said in a statement.

"The Mujahedeen do not conduct such attacks and such attacks do not bring any benefit to them."

A local deputy police chief, Nissar Ahmad Abdulrahimzai, told Reuters that police had been tipped about the car and were chasing it when it exploded.

"The explosion was so big it destroyed many shops. Dozens of people are trapped under the roofs," Mohammad Raza Kharoti, the district governor, told Reuters.

"The number of wounded will rise to more than 100, and the number of those martyred will also increase."

In Kabul, a remote-control bomb concealed by a roadside killed two employees of President Hamid Karzai's media office and wounded five, police said. The Taliban claimed responsibility.

The attacks took place as foreign troops are gradually withdrawing from the country. The United Nations said last week that civilian casualties jumped by almost a quarter in the first half of this year as hostilities escalated.

(Reporting by Mirwais Harooni in Kabul; Additional reporting by Michelle Nichols at the United Nations; Writing by Maria Golovnina; Editing by Ron Popeski and Jonathan Oatis)