The 87-year-old former Conservative prime minister was admitted to hospital on Thursday to have a growth removed from her bladder.
It is expected she will remain in hospital over Christmas.
A spokeswoman for Thatcher said she was "absolutely fine" after the procedure.
Tim Bell, a friend and former adviser to the baroness, said she was expected to need several days of recuperation.
He said the former politician had been in pain earlier in the week and was sent by her doctor to hospital, where it was decided the operation was required.
"The operation was a complete success and her condition is satisfactory," Bell said. "She'll stay in hospital for a few more days and then she'll go home."
A tweet from Cameron's office yesterday said: "PM wishes Lady Thatcher a speedy recovery."
Thatcher cut back on public appearances after suffering a series of mild strokes in 2002. She was not well enough to join the Queen for a lunch with former and serving prime ministers as part of the Diamond Jubilee this summer.
Two years ago she missed an 85th birthday party thrown for her by Prime Minister Cameron at 10 Downing Street.
Thatcher's health was a focus of attention this year when Meryl Streep starred in a Hollywood film about her. The film, The Iron Lady, drew criticism from Cameron and others for concentrating on the dementia she has suffered.