The bomber targeted a group of police gathered outside the High Court building ahead of an anti-government protest, officials said.
He blew himself up after being approached by police.
The attack comes amid extreme political tension following the assassination of opposition leader Benazir Bhutto.
Parliamentary elections which had been scheduled for 8 January were subsequently postponed until 18 February.
Bodies on ground
The blast happened just before noon local time (0700 GMT), when the courts are at their busiest.
Television footage showed a scene of devastation in the area in front of the High Court.
"The explosion was horrible and a number of people, including police officers, were lying dead on ground," a passer-by, Tariq Javed, told the BBC.
Mohammad Arshad, a clerk in a lawyer's office across the road from the blast, said he saw blood and bits of flesh sticking to the broken windows of his building.
"The whole building shook and when I ran out I saw bodies lying all around. There was flesh and blood everywhere and people were crying for help," he told the Reuters news agency.
There was no immediate claim of responsibility.
Police said the attacker was a young man who had arrived outside the court on a motorbike.
RECENT ATTACKS 27 Dec: Opposition leader Benazir Bhutto and 20 people killed in suicide attack in Rawalpindi 21 Dec: At least 50 dead in a suicide attack on a mosque in north-western Pakistan 24 Nov: Twin suicide car bombings kill at least 30 in Rawalpindi 19 July: More than 40 killed in three separate bomb attacks across the country 14 July: 24 soldiers killed in suicide attack on a military convoy in north-western Pakistan 28 April: Suicide bomber kills at least 22 people at a rally in North-West Frontier Province
"He parked his bike and walked to the police and blew himself up," police official Jameel Ahmed told Reuters.
Police said the explosion was timed to cause maximum damage.
City police chief Malik Mohammad Iqbal said that all but one of the victims were policemen.
The officers were gathering outside the court building ahead of a protest by lawyers against the rule of President Pervez Musharraf.
Pakistan has seen a massive rise in suicide bombings since 2007.
According to the Interior Ministry, the country was hit by over 50 suicide attacks last year, which claimed at least 3,000 lives.
Government officials had warned of an increased risk of attacks in Lahore ahead of Muharram, the first month of the Islamic lunar calendar, which starts on Friday.
Muharram is often marred by sectarian violence between Shia and Sunni Muslims.
Did you witness the attack or were you in the area? Use the form below to send us your accounts, some of which may be published.
Name
Your E-mail address
Town & Country
Phone number (optional):
Comments
At least 24 people were killed and more than 60 were injured when a suicide bomber struck outside a courthouse in the Pakistani city Lahore. The bombing took place at approximately 0700 UTC (1200 local time)

Lahore Police Chief Malik Iqbal says the bombing was aiming at police deployed outside the Lahore courthouse Thursday preparing for an anti-government protest by lawyers.

"This was a suicide attack and the police on duty were the target," he said.

Local television footage showed a chaotic scene outside the courthouse, with the road littered with the dead and injured. 

Pakistan has suffered from a wave of bomb attacks in recent months, mostly against the security forces.  Hundreds of people have been killed. The government blames Islamic militants linked to al-Qaeda for the attacks.

Two weeks ago opposition leader and former Prime Minister Benazir Bhutto was assassinated in a bomb and gunfire attack as she left an election rally in Rawalpindi.

Police Chief Iqbal says security has been tightened, throughout Lahore, following the latest attack.

"A large number of police are deployed...and the entire police (are) under high security alert and a large number of policemen are spread out around Lahore…. And, we are enhancing the security of important personalities," he said.

However, Ayaz Amir, a political analyst, says the continuing violence, coupled with a deepening power crisis, is plunging the nation into chaos.

"It really means a greater slide into chaos. The government is loosing its grip," Amir said. "It doesn't have its grip on anything…They don't have a grip on energy, the power cuts and they don't certainly have a grip on the suicide bombers or whoever is causing mayhem across the country.  They don't have a grip on that."

President Pervez Musharraf declared a state of emergency last November and suspended the constitution.  He says the extreme measures were necessary to curb rising violence by Islamic militants.

But opponents say his real motive was to dismiss judges who were getting ready to rule that his re-election as president had been illegal.  Since then, the nation's lawyers have been among Mr. Musharraf's strongest critics.

The emergency was lifted in December and elections were scheduled for this month.  But the three days of rioting that followed the Bhutto assassination prompted Mr. Musharraf to postpone the elections to February 18.