SAN FRANCISCO — When Jake Peavy joined the San Francisco Giants midseason, he brought an energy to the mound that added a new dimension to their rotation.

Now, the Giants are keeping a key member of their World Series championship team, bringing back Peavy with hopes of another special October.

The right-hander agreed to a $24 million, two-year contract to stay with San Francisco, two people familiar with the negotiations said Friday.

Also on Friday night, the Giants were hopeful of completing a trade with the Marlins to bring third baseman Casey McGehee to San Francisco, a person with knowledge of the discussions said. McGehee would replace Pablo Sandoval, who signed last month with the Boston Red Sox.

MULTIPLAYER DEAL: The Rays, Padres and Nationals finalized an 11-player trade that sent Wil Myers from Tampa Bay to San Diego and outfielder Steven Souza Jr. from Washington to the Rays.

The deal was formally announced Friday, two days after the Rays agreed to part with Myers in a move that team president Matt Silverman said will make Tampa Bay “more competitive for 2015 and beyond.”

Tampa Bay acquired five players. Catcher Rene Rivera, pitcher Burch Smith and minor league first baseman Jake Bauers come from the Padres, and Souza and minor league pitcher Travis Ott from the Nationals.

Myers, catcher Ryan Hanigan and minor league pitchers Jose Castillo and Gerardo Reyes were dealt to San Diego. Washington received minor league pitcher Joe Ross and a player to be named from the Padres.

LUXURY TAX: The Dodgers have ended the New York Yankees’ 15-year streak as Major League Baseball’s biggest spenders and owe more than $26.6 million in luxury tax.

Los Angeles finished with a record payroll of $257,283,410, according to final calculations made by Major League Baseball and obtained by The Associated Press. That is more than $20 million above the previous high, set by the Yankees last year.

The Dodgers owe $26,621,125 based on a $277.7 million payroll for purposes of the tax. The Yankees owe $18.3 million.

DRUG INVESTIGATION: A sixth man is set to plead guilty for his role in illegally providing performance-enhancing drugs to major league players.

A federal judge scheduled a plea hearing for 48-year-old Juan Carlos Nunez, who is charged with conspiracy to distribute steroids such as testosterone.

Court documents say Nunez told at least one unnamed professional baseball player he could help obtain steroids.

SELIG’S NEW TITLE: Bud Selig will be given the title of baseball commissioner emeritus when he retires next month.

The 80-year-old Selig has led baseball for 22 1/2 years. He will be succeeded by Rob Manfred, baseball’s chief operating officer.

“This role will allow the game to benefit from his unmatched institutional knowledge, experience and relationships,” Manfred said in a statement Friday. “I could not ask for a finer mentor.”

YANKEES: New York acquired pitcher Nathan Eovaldi, outfielder Garrett Jones and minor league pitcher Domingo German from the Marlins for versatile Martin Prado and pitcher David Phelps.

Eovaldi, a right-hander who turns 25 in February, was was 6-14 with a 4.37 ERA last season.

Prado, 31, plays second, third and outfield. He is owed $11 million each of the next two seasons.

 The Yankees acquired right-hander Gonzalez Germen from the Mets for cash in the first trade between the New York rivals since 2004.

PHILLIES: The team finalized its trade of Jimmy Rollins, sending the All-Star shortstop and $1 million to the Los Angeles Dodgers for right-hander Zach Eflin and left-hander Tom Windle. The deal was agreed to last week at the winter meetings.

CUBS: The team finalized a $4.5 million, one-year contract with reliever Jason Motte. The deal allows the former St. Louis closer to earn $2.5 million more in performance bonuses.

PIRATES: First baseman Corey Hart agreed to a $2.5 million, one-year contract.