The Red Sox traded Jon Lester and Jonny Gomes to the A’s for outfielder Yoenis Cespedes and the second pick in the competitive balance Comp B round Thursday, according to Alex Speier of WEEI.com.

Lester and Gomes will both be free agents at the end of the year. Lester, 30, is 10-7 with a 2.52 ERA this season, and is on pace to post the best ERA, ERA+, WHIP and strikeout-to-walk ratio of his career. He has a 1.97 ERA in 11 playoff starts, and a 0.43 ERA in three World Series appearances. Gomes, 33, is hitting .234 with six home runs in 246 plate appearances.

Cespedes, 28, defected from Cuba in 2012. He’s a legitimate right-handed power bat who the Red Sox seemingly lacked within their organization, and has hit 66 home runs in his first three years in the Major Leagues. He’ll be a free agent after the 2015 season.

The A’s lead the AL West with a 66-41 record. Lester gives them a bona fide ace with a playoff track record as the team looks to make its first World Series since 1990. Gomes will conceivably take Cespedes’ place in left field.

The A’s acquired right-handed starting pitchers Jeff Samardzija and Jason Hammel from the Cubs July 4. Hammel has struggled mightily since moving to the AL, as he’s posted a 9.53 ERA in four starts.

Lester said at the Boston Baseball Writer’s Dinner in January he’d be willing to take a hometown discount to remain with the Red Sox. The club proceeded to offer him a four-year, $70 million contract that he declined in Spring Training.

There was reportedly little movement between the Red Sox and Lester in regards to a contract extension during the first four months of the regular season. CBS Sports’ Jon Heyman reported at the All-Star Break that Lester’s camp preferred to hold off on negotiations until the off-season.

Red Sox principal owner John Henry reiterated those sentiments in an email the Boston Herald July 24, in which he said the team wouldn’t resume deliberations with the left-hander until free agency.

It appears as if Lester’s market value lies between $23 and $24 million annually. His contemporaries, Cole Hamels and Zack Greinke, inked six-year contracts worth $144 million and $147 million, respectively, in 2012. Reigning AL Cy Young winner Max Scherzer turned down a six-year, $144 million extension offer from the Tigers in March.

Lester has reiterated his desire to remain in Boston throughout the past several months. He even said he would be open to re-signing with the Red Sox if the team traded him prior to the deadline.