Cambridge Crown Court heard that Mitchell Bird assaulted Bradley Carter at a flat in Wisbech on 14 February.
The jury was told Mr Carter, 35, complained of pain before being taken to hospital by his mother on 19 February, where he collapsed and died.
Mr Bird, 29, of Cox Close, Wisbech, denies murder.
Opening for the prosecution, Richard Christie QC said Mr Carter had gone to Mr Bird's flat to stay after he had been "kicked out" of his mother's house for openly taking drugs.
The court was told both Mr Carter and Mr Bird were regular drug users.
Neighbours reported a disturbance and "commotion" on the night of 14 February, and Mr Bird had accused his friend of trying to steal from him, the court heard.
Read more Cambridgeshire stories here
The court was told that Mr Carter claimed Mitchell Bird had "beat him repeatedly with a hammer" causing "holes in his legs".
Jurors were shown pictures of Mr Carter's injuries taken by himself and his mother in the days between the attack and his death.
Mr Christie explained that Mr Carter had an enlarged spleen that lay outside his ribcage, and it was damaged "in the course of this attack from kicks to his body".
The attack "caused him to haemorrhage and bleed internally" when his spleen later ruptured, he added.
Mr Carter had complained to friends and family about the attack, as well as to a probation officer and housing officer, the court heard.
On 19 February, his mother Helen Barnes took him to the Queen Elizabeth Hospital in King's Lynn for tests because his condition was not improving and he complained of "significant back pain".
When she returned from paying a parking meter, her son had collapsed and died, the jury was told.
"Although there was a delay in Bradley Carter dying, this defendant murdered him," Mr Christie said.
"We have clear evidence in this case that points to Mitchell Bird having perpetrated that assault."
Mitchell Bird denies one count of murder and one count of grievous bodily harm with intent.
The trial continues and is expected to last two weeks.
A man "soldiered on" after a "serious and brutal" hammer attack by a friend before dying five days later, a court was told.