BOSTON -- The Boston Red Sox traded ace pitcher Jon Lester and outfielder Jonny Gomes to the Oakland Athletics not with an eye to the distant future, but to next season, acquiring slugger Yoenis Cespedes.

The Red Sox will also get Oakland's competitive balance draft pick while the Athletics received cash considerations in the trade, which bolsters Boston's historically weak outfield offense.

The deal, which took place hours before baseball's 4 p.m. ET non-waiver trade deadline Thursday, marks the end of Lester's storied stint with the Red Sox, who won two World Series championships with the left-hander in their rotation.

"My last conversation with him was in the clubhouse," Red Sox general manager Ben Cherington said. "He came in to clear some stuff out so I got a chance to go down and see him in person today. That was a thank you and an appreciation for everything he's done and a good luck.

"He's going to a new place and he's going to be pitching in big games down the stretch and he'll have an opportunity to win again. We'll be rooting for him."

The Red Sox made three other trades Thursday, including sending veteran starter John Lackey to the St. Louis Cardinals for outfielder Allen Craig and right-hander Joe Kelly, and a deal with the rival Yankees that sent shortstop Stephen Drew to New York in exchange for veteran infielder Kelly Johnson.

"We felt like what made the most sense for us was to try to focus on impact major league talent that is ready and we have a lot of good young players, we have strength in our farm system, so that is already a strength," Cherington said. "Although there were some prospect packages or prospects available to us that were very attractive, we wanted to add to the major league team and really give ourselves a head start on like I said building again and becoming as good as we can as quickly as possible.

"That guided us at least on the Lester and Lackey deals toward more proven major league players."

Lester, who is scheduled to become a free agent after this season, had publicly stated his desire to remain with the Red Sox. But contract negotiations stalled this past offseason, when Lester reportedly turned down Boston's four-year, $70 million offer.

Red Sox slugger David Ortiz, a teammate of Lester's since 2006, tweeted farewell to the ace pitcher on Thursday morning.

Wishing my man Jon Lester all the best, Red Sox Nation and the Large Father will miss you! pic.twitter.com/7uWpXw8XnH - David Ortiz (@davidortiz) July 31, 2014

Athletics general manager Billy Beane, who has been the featured subject of a best-selling book and hit movie but has never taken a team to the World Series, left little doubt he is all-in for October by making his second blockbuster trade for a starting pitcher in less than a month.

Beane surrendered his top two prospects to the Chicago Cubs on July 5 in a trade for All-Star Jeff Samardzija and veteran right-hander Jason Hammel. In Lester, Oakland is adding a pitcher with a glittering postseason resume, including a 0.43 career ERA in the World Series.

Beane followed up the Lester deal Thursday morning by trading left-hander Tommy Milone to the Minnesota Twins for outfielder Sam Fuld. Oakland has a 66-41 record, the best in the American League, but leads the second-place Los Angeles Angels by just 2 ½ games in the AL West.