Reading from a 13-page document that he wrote in custody, Anders Behring Breivik defended his massacre and called it the most "spectacular attack by a nationalist militant since World War Two".
He said he would repeat his actions again, if he could.
"Yes, I would do it again," he said, adding that life in prison or dying for "his people" would be "the biggest honour".
The 33-year-old lashed out at the Norwegian and other European governments for embracing immigration and multi-culturalism and claimed he was a "second-rate citizen".
He said the aim of the killings was for "racial purity" and to "change the direction of multi-cultural drift to avoid greater confrontation and civil war".
He claimed the only way he could "protect the white native Norwegian" was through violence.
"People will understand me one day and see that multi-culturalism has failed. If I am right, how can what I did be illegal?" he said.
During cross examination, Breivik claimed to be the "cell commander" of an anti-communist and anti-Islam militant group called the Knights Templar, adding he was "one of three one-man cells" in Norway.
Prosecutors have said the group does not exist.
He also claimed he was on a "suicide mission" and "didn't expect to survive the day".
During his testimony, which was expected to last 30 minutes but overran by an hour, there were numerous interruptions by the judge who asked Breivik to moderate his language and curtail the length of his address.
There were also several people in the Oslo courtroom who were seen yawning.
Sky's Europe correspondent Robert Nisbet, who is at the court, said: "It was a rambling speech.
"He delved into history he made references to World War Two, Tibet and Enoch Powell's Rivers of Blood speech, and a lot of it didn't make sense."
Journalist Trygve Sorvaag, who is tweeting inside the court for Sky News, said: "For many people, it was very surprising to hear how soft, almost nasal, his voice was. He didn't appear dangerous in any way.
"It was very hard to see that this softly spoken man is actually the person who murdered 77 people."
A survivor of the massacre, Bjoern Magnus Jacobsen Ihler, spoke to Sky News after Breivik's testimony.
"It was very difficult for me in many ways to sit in the same room as the man who killed many of my friends, and who tried to kill me," he said.
"But it was good to see him in this position because he is very reduced from where he was, and he can't harm me anymore."
Breivik's testimony began after proceedings were delayed by almost an hour because of a court crisis meeting.
The trial was thrown into confusion after lawyers on all sides requested that a lay judge should not continue to sit on the five-judge panel for saying that the "only fair outcome" for Breivik was the death penalty.
Thomas Indreboe admitted posting the comment on Facebook the day after Breivik's massacre on July 22.
Norway does not have the death penalty.
Judge Wenche Elizabeth Arntzen returned to the court to announce that Mr Indreboe had been dismissed and replaced by back-up lay judge Elisabeth Wisloeff.
Breivik is being tried by a panel of two professional judges and three lay judges. The system is designed to let ordinary citizens have a role in the Norwegian justice system.
On Monday at the start of his trial, Breivik pleaded not guilty to charges of terrorism and murder but said he "acknowledges the acts" and that he killed in "self-defence".
His lawyer, Geir Lippestad, said that while the court must consider Breivik's mental state at the time of the attacks, it was the defendant's wish to be sentenced as legally sane.
If Breivik is found sane, he faces 21 years in prison for the killings - although the sentence may be extended indefinitely if he is still considered a threat to society.
If he is found insane, he could spend the rest of his life on the closed psychiatric ward, a fate he has declared would be "worse than death".
Breivik has admitted detonating a fused bomb in the centre of Oslo and opening fire on people attending a youth summer camp on Utoya island.
He claims the attacks were a political act designed to prevent what he describes as an Islamic invasion of Norway.
On the day his attack, Breivik first targeted Oslo's government district with a 950kg car bomb, which killed eight people and injured more than 200.
Then on Utoya, where the youth wing of the country's Labour Party was holding its annual summer camp, he killed 69 people and injured another 33.