Hamilton described one transfusion which caused an adverse reaction from his body, making his urine turn black.
Speaking through an interpreter by video link from the Spanish embassy in Washington, Hamilton spoke for almost three hours about his time as a patient of Spanish doctor Eufemiano Fuentes between 2002-04 when the rider paid him as much as 110,000 euros (£90,000) for his services.
The 41-year-old, who came clean about his doping past in an award-winning book 'The Secret Race', said he met Fuentes, who denies involvement in doping, at a clinic or in apartments in Madrid and Monaco and in "many, many hotel rooms" and the pair spoke and sent text messages using "secret phones".
With Fuentes watching him on a large-screen television, the American told the court in Madrid his first blood transfusion under the doctor's direction was in March 2002 and he said he had met him "probably 15 times", each time having blood extracted or reinjected.
Their relationship ended in September 2004 when traces of someone else's blood was found in one of Hamilton's samples and the rider was suspended for two years, he added.
Last August the American was stripped of the time-trial gold medal he won at the 2004 Athens Games by the International Olympic Committee.
"Yeah he (Fuentes) gave me a calendar with a schedule of races, a schedule of when to take what performance-enhancing drug and if I remember right he gave me EPO (erythropoietin)," Hamilton told the court.
"He offered me EPO, testosterone, growth hormone, insulin, I think that's it," added the American who was wearing a light grey suit, white shirt and striped tie. "My biggest fear was something like this (trial) would happen."
Fuentes and four other defendants, including his sister Yolanda, are appearing in court almost seven years after anabolic steroids, transfusion equipment and numbered blood bags were seized by police as part of the Puerto investigation.
The proceedings have attracted international scrutiny because anti-doping authorities, who are represented in court, are hopeful it will finally lead to evidence of wrongdoing by athletes in sports other than cycling coming to light.
Fuentes said shortly after the trial began he had clients in sports including soccer, tennis, athletics and boxing.
A World Anti-Doping Agency request for access to the blood bags has been repeatedly denied by the Spanish courts and the organisation awaits the Puerto judge's ruling on their latest petition made last month.
As Spain's current anti-doping legislation was not in force in 2006 when the police raids took place, Fuentes and his fellow accused are being tried for violating public health regulations and the prosecutor has asked for prison terms of two years.
Hamilton, who said he used EPO and banned growth hormone treatments before becoming involved with Fuentes, was questioned about whether he had been warned of the possible risks from blood doping and if he had any adverse reaction to the transfusions or drugs.
He said he had always checked to make sure his code number "4142" was on the bags of blood to be reinjected.
"I had a transfusion in July of 2004 (during the Tour de France) that gave me a bad fever and I felt sick," said Hamilton. "The reason why I knew was that 30 or 40 minutes later when I went to the bathroom my urine was black.
"The insulin I tried one time but did not like the way it made me feel, sweating, increased heart rate, just a strange sense.
"You'd always feel a little bit different. I would say that no two times were exactly the same. But yeah your body reacted to the blood extractions and reinfusions."
The judge asked Hamilton if he had anything to add at the end of his testimony.
"Yeah I'm sorry for breaking the rules," he said.
Fuentes responded to Hamilton's testimony, saying: "He knows what he has done, he has said he has done many things with many people"
The lawyer for one of the defendants then announced he no longer wished to call Spanish rider Alberto Contador to the stand.
Contador, who was stripped of his 2010 Tour de France title after testing positive for a banned substance, was due to appear in court on Friday.
The trial is set to end on March 22.
- Politics & Government
- Sports & Recreation
- Eufemiano Fuentes