The jail term can be reviewed and extended indefinitely if Breivik -- a far-right extremist responsible for a bomb attack and peacetime Europe's deadliest gun rampage -- is deemed a continued threat to society.
Breivik said he would not appeal the prison sentence, his lawyer said. He had wished to be found sane so that his Islamophobic and anti-multicultural ideology would not be considered the rantings of a lunatic.
On July 22, 2011, Breivik started his rampage when he set off a van bomb in Oslo that killed eight people and then took 69 more lives, mostly teenagers', in a shooting frenzy at an island summer camp near the capital.
A five-member panel at the Oslo District Court unanimously found Breivik guilty of "acts of terror", ending a spectacular 10-week trial for Norway's worst post-World War II massacre.
"The ruling is unanimous," presiding judge Wenche Elizabeth Arntzen told the court, packed with emotional survivors and relatives of victims. "He is sentenced to prison for 21 years, with a minimum of 10 years."
Breivik, wearing a dark suit with a white shirt and a grey tie, smiled as the verdict was read out in court.
Minutes earlier, after his handcuffs were removed, he had raised his clenched fist in a far-right salute, as he had done often during the trial.
Knut Storberget, who was Norway's justice minister at the time of the attacks, hailed the sentence, telling television channel TV2: "It's a good basis for him to stay in prison for the rest of his life."
"It's the heaviest sentence he could get."
Norway's penal code does not have the death penalty or life in prison, and the maximum prison term for Breivik's charges is 21 years. However, inmates who after that are still considered a threat to society can be held indefinitely.
Most Norwegians wanted Breivik to be found sane and responsible for his actions, after it came out that he spent years methodically planning his attacks.
And most survivors of the Utøya island massacre said they were pleased with the sentence and hoped they could now move on with their lives.
"It has been one hell of a year. I hope with today it will be over," 19-year-old Caroline Svendsen told AFP.
She was one of the few who questioned the sanity ruling, saying "no one in their right mind would do this."
Others took to Twitter immediately. Viljar Hansse, who survived a bullet to the head in the shooting spree, tweeted: "Finished. Period."
Another Utøya island survivor, Ingrid Nymoen, said in a short message: "This crap is finally over. Life can start now."
"It's a good and correct ruling," tabloid VG wrote in an editorial on its online edition, adding that Breivik "knew what he was doing, that it was evil."
An expert psychiatrist monitoring the Breivik case agreed.
"Breivik showed a high degree of consistency during his detention," Kjersti Narud told Norwegian news agency NTB.
"I can't rule out that he might have been suffering from psychosis at the time of the attacks, but if he was, it could not have been extreme enough to exempt him from criminal responsibility."
The judges stressed that while Breivik suffered from personality disorders, he was not psychotic.
Breivik's lawyer Geir Lippestad told journalists outside the courtroom: "He says he won't appeal now that he has been found sane."
The main question the court had to answer was whether Breivik, a self-styled Nordic warrior against Europe's "Muslim invasion" and multiculturalism, was sane and could be held responsible for his actions.
Breivik, who laid out his hateful world view in a rambling 1,500-page online manifesto, was diagnosed with paranoid schizophrenia and declared criminally insane after his arrest for the deadly rampage.
However, a public outcry led to a second assessment which found him legally sane, an opinion shared by most Norwegians according to surveys.
Prosecutor Svein Holden had called for him to be sent to closed psychiatric care, arguing that "it would be worse to sentence someone who is psychotic to prison than to send someone who is not psychotic to psychiatric care."
Judge Arntzen recounted Breivik's Oslo childhood, his later failed business ventures, including selling fake diplomas, and a trip to Liberia, before he moved back in with his mother.
From 2006 to 2008 he committed himself to the real-time online role-playing game 'World of Warcraft', for up to 16 hours a day, she said.
He spent his time in seclusion penning his manifesto "2083: A European Declaration of Independence", the date marking the 400th anniversary of the 1683 Battle of Vienna which prevented the Ottoman empire from taking over Europe.
She recounted that Breivik called himself the "cell commander", "knight" or "perfect foot soldier" of a clandestine group called the Knights Templar, the name of an order of Crusaders during the Middle Ages.
But the judge said the court "has found no evidence for the existence of the Knights Templar" group Breivik claimed to have co-founded.
The court also heard about the lengths Breivik went to to plot his attacks.
Judge Arne Lyng said Breivik took steroids, worked out at a fitness centre and went on hikes with a backpack full of rocks, Lyng said.
In the days before the attacks, he started taking a cocktail of ephedrine, caffeine and aspirin -- a stimulant mix with an effect similar to that of amphetamine that boosts confidence, the willingness to take risks and leads to "increased risk of aggression and violence" according to experts, Lyng added.
He also practised a meditation technique, borrowed from ancient Japanese warriors, "to de-emotionalize himself", and before the attacks played a total of 130 hours of a shooting video game "Call of Duty", the judge said.
Breivik is expected to serve his sentence at the high-security Ila prison near Oslo.