"I'm excited," Bonds said.
"I'm glad we could get it worked out."
The deal, worth $15.8 million with incentives that could bring him near $20 million, gives the Giants protection in case Bonds misses games due to the ongoing BALCO investigation.
Forty-two year-old Bonds told the BALCO grand jury that he never knowingly took performance-enhancing drugs, and is now the subject of a grand jury perjury investigation, with his historic home run totals now under scrutiny.
Bonds' personal trainer, Greg Anderson, is one of five men to serve jail time in the BALCO scandal.
"The agreement was finalized only after we achieved reasonable assurances and protections, and only after we were convinced that the Giants' players will be able to function as a team committed to supporting each other and dedicated to doing everything they can to succeed on the playing field," Giants president Peter Magowan said.
More drug allegations
Adding to the steroid controversy was a New York Daily News report earlier this month saying Bonds failed an amphetamine test last year with the veteran issuing an apology statement but not facing a ban.
Fans are sceptical about Bonds' home run
records after his link to steroids [EPA]
Under major league rules, Bonds would only be banned if he commits a repeat amphetamine violation, with a first violation not even requiring confirmation of the positive test, in stark contrast to global anti-doping rules.
"The process of negotiating this contract was complex, lengthy and highly unconventional," Magowan added.
"We spent significant time evaluating all of the elements and circumstances surrounding the negotiations before we made a final determination to move forward."
Bonds batted at an average of .270 with 26 homers and 77 runs batted in over 130 games last season, and has hit at least 22 homers in 16 of his past 17 seasons, failing to do so only in his injury-shortened 2005 campaign.
George Mitchell, former US Senator, is leading a panel created last March by commissioner Bud Selig looking into baseball's steroid past, but has been unhappy with a lack of cooperation in the probe.