Ballesteros was in stable condition in the intensive care unit after the operation to implant a valve in his brain, La Paz hospital said.
Doctors also repaired a bone defect stemming from one of the procedures the golf great has undergone since his initial operation on Oct. 24 to remove a malignant brain tumor.
A hospital official declined to say if the latest surgery meant the 51-year-old Ballesteros had taken a turn for the worse in his recovery. He had been released from intensive care Nov. 18 but remained hospitalized.
Ballesteros was first admitted on Oct. 6 after fainting at Madrid's international airport.
Ballesteros, who won a record 50 tournaments on the European Tour, has called the situation the "hardest challenge of my life."
The Spaniard won three British Opens and two Masters and is often praised for having transformed European golf. He helped Europe beat the United States in the 1985 Ryder Cup to begin two decades of dominance, and captained the European team to victory in 1997 in Valderrama, Spain.