San Francisco is sending right-hander Heath Hembree and lefty Edwin Escobar to the World Series champion Red Sox in the swap.
Peavy will make his Giants debut in Sunday night's series finale (8 p.m. ET on ESPN) against the Los Angeles Dodgers at AT&T Park. The Giants trail the Dodgers by a half-game in the NL West after Saturday night's 5-0 loss.
"There's going to be a lot of cramming going on," Peavy told CSN Bay Area. "But I am familiar with this division."
The Giants have plenty of familiarity with Peavy, who pitched for manager Bruce Bochy with the San Diego Padres in the playoffs in 2005-06.
"It's great to be reunited with Jake," Bochy said by text message. "Look forward to working with him again."
The Red Sox and Giants will split the remaining $5 million owed to Peavy this season, a source told ESPN's Buster Olney.
"I think he was a real key guy in the 2013 season and so we're glad we traded for him," Red Sox general manager Ben Cherington said. "Hopefully this gives him another opportunity to do the same. He's going to a good place, he's going to a good team, he's going to a manager he knows and a team that's certainly in it.
"We hope it works out well for him and wish him the best."
Peavy (1-9, 4.72 ERA) has been hurt by poor run support this season, receiving two runs or fewer in each of his past eight starts.
Although Peavy spent less than a year with the Red Sox and cost Boston shortstop Jose Iglesias in the three-team trade with the Chicago White Sox and Detroit Tigers, Cherington said he would make the deal again.
"Well, we won the World Series and he was part of it," Cherington said. "I think it worked out well. Hopefully he feels that way.
"At the time we made the trade we felt like the most important thing to do at that time was to protect the starting rotation. You don't know exactly what's going to happen down the stretch, but we thought we had a chance to win and felt if there was one thing to do to protect our chances to do that, it was to protect the rotation.
"I would certainly make the trade again. He certainly added a lot, particularly last year."
Yusmeiro Petit had been scheduled to pitch Sunday for the Giants with right-hander Matt Cain on the disabled list.
The Giants made the deal without having to give up their top pitching prospect, Kyle Crick.
It's been a busy week for Giants general manager Brian Sabean and assistant GM Bobby Evans.
On Friday, they promoted second baseman Dan Uggla from Triple-A Fresno only four days after they signed him to a minor league contract Monday. Uggla was released by Atlanta on July 18.
For the Red Sox, meanwhile, the Peavy deal could be the beginning of a fire sale with the team 10½ games back in AL East entering Saturday night.
Mike Carp has requested a trade, a source told ESPNBoston.com's Gordon Edes, who said movement on a deal is "a work in progress.''
Cherington, meanwhile, didn't rule out additional trades, including one involving ace lefty Jon Lester.
"As you start marking down the days before Thursday, it does mean something," he said. "There's a reason why they call it a deadline. We have to be mindful of what that means, where we are, what the math says about our chances."
The loss of Peavy will leave a void in the clubhouse, players said.
"His personality, the type of person he is, he came in here and fit in, not just on the field but off," first baseman Mike Napoli said. "We hung out. He has a great family, a genuine person who cares about everybody. A good friend."
The Red Sox confirmed that Allen Webster will start in Peavy's place on Sunday.
ESPN's Jim Bowden and The Associated Press contributed to this report.
Peavy Set To Make Giants Debut
The "Baseball Tonight" crew breaks down the "Sunday Night Baseball" matchup between the Dodgers and Giants.
Does Jake Peavy Have Fantasy Value?
The "Baseball Tonight" crew breaks down whether Jake Peavy can help your fantasy baseball team.