The 32-year-old, who is one of Italy’s most popular musicians, announced last week that he was seriously ill, but did not provide further details.
“Last week, I discovered that I had a rare pancreatic neuroendocrine tumour,” Fedez wrote in an Instagram post on Thursday.
“It’s one of those things that, if you don’t catch it on time, it’s not a nice roommate to have inside your body.
“That’s why I had to have surgery that lasted six hours to remove part of my pancreas (tumour included).
“I’m doing well and I can’t wait to return home to my children.”
The post was accompanied by a photo of the rapper in a hospital gown making the peace sign with his fingers.
Fedez’s wife, influencer Chiara Ferragni, also took to Instagram to provide an update.
“This pic was taken on Monday afternoon at the hospital, the day before his delicate pancreas surgery,” she wrote in English.
“We were scared for everything: his diagnosis, his surgery, his recovery, our life and the fiture of our family.
“The surgery on Tuesday went well, and he’s now recovering and hopefully this will only be a bad memory that taught us, once again, the importance of enjoying life to the fullest, everyday.
“Thanks to all the people who made us feel their love, reached out and said a prayer for us, it gave us a lot of strength.”
The couple have two children together: Leone, who turned four years old last week, and Vittoria, who celebrated her first birthday on Wednesday.