The judges handed down a sentence that went beyond the request of prosecutors, who had called for the 76-year-old billionaire to serve six years.
The sentence is "completely illogical. The judges even went beyond the prosecutors' request," Berlusconi's lawyer Niccolo Ghedini told journalists after the verdict was read out.
A small group of protesters cheered and applauded outside the courtroom, and sang the national anthem.
The sentence will be suspended until all appeals have been exhausted, a process likely to take years.
Also Read
Berlusconi's age also means he is unlikely to ever see the inside of a prison cell because of lenient sentencing guidelines in Italy for people over the age of 70.
The trial relates to crimes committed in 2010 when Berlusconi was prime minister, and revolves around what prosecutors have described as erotic parties held at his luxury residence outside Milan.
He was also accused of having called a police station to pressure for El-Mahroug's release from custody when she was arrested for theft.
His defence claimed he believed El-Mahroug was the niece of former Egyptian president Hosni Mubarak and wanted to avoid a diplomatic incident, but prosecutors insisted it was a bid to conceal their liaison.
While abuse of office was the more serious of the charges, it was the sex with the pole dancer after racy "bunga bunga" evenings in a basement room of his mansion that mesmerised the public.
Both the flamboyant billionaire and El-Mahroug denied having had sex.
Prosecutor Ilda Boccassini told the court in her summing up speech last month that El-Mahroug was "part of a prostitution system set up for the personal sexual satisfaction of the defendant".
She said the dancer quickly became the premier's "favourite" and had not admitted the relationship with him only because she had received as much as 4.5 million euros from him.