Jurors at the Jacko trial heard testimony from a surprise witness yesterday — the ghost of Michael Jackson!

Randy Phillips, CEO of concert promoterAEG Live, testified about a chat he had with his longtime friend Brenda Richie, who claimed to have talked to a medium who had channeled the spirit of The Gloved One after his 2009 death.

In the supernatural tête-á-tête, Jacko’s ghost allegedly absolved Dr. Conrad Murray of any guilt in his death and admitted he “accidentally killed himself,” Phillips said.

“Brenda called me to tell me that she was in communications with Michael either through a medium or directly,” Phillips told jurors about his talk with Richie, the ex-wife of singer Lionel Richie.

“She said Michael told her that it wasn’t Dr. Murray’s fault, that he had accidentally killed himself.”

Brian Panish, a lawyer for Michael Jackson’s family, objected to Phillips’ ghost story, calling it triple hearsay, since Phillips was relaying a chat from Richie, who had heard from a medium, who — allegedly — spoke to a dead Jacko.

Remarkably — over the laughter of courtroom spectators — LA County Superior Court Judge Yvette Palazuelos allowed Phillips’ explanation to stand.

Phillips’ wacky testimony yesterday was in response to questions about an e-mail he sent on Aug. 18, 2009, implying he believed the medium’s talk with Jacko would prove Murray wasn’t behind his death.

“I think I know what MJ died of and this would exonerate Conrad,” he wrote.

When the e-mail was first brought up Monday, Phillips said he didn’t recall what he had been talking about. But yesterday, he offered up his weird tale from the crypt.

Jackson’s family is suing AEG Live, claiming that concert promoters knew the King of Pop was in declining health but did nothing to help him — other than hire Murray.

AEG officials insist they had no idea Jackson was in such fragile shape and argue the company shouldn’t be held liable for Murray’s criminal acts.

In an odd coincidence, Jackson’s brothers. Jermaine, Tito, Randy and Marlon, are set to perform at AEG-owned Staples Center in downtown LA later this month during the BET Awards broadcast.

On his way out of court yesterday, Jackson family lawyer Kevin Boyle quipped, “I hope the Jackson brothers survive their AEG Live experience.”