SAN DIEGO — Pitcher Jon Lester agreed late Tuesday night to a $155 million, six-year contract with the Chicago Cubs, a person familiar with the negotiations said, the first big deal of the offseason involving a top-level starting pitcher.

The person spoke on condition of anonymity because the agreement had not been announced.

Lester’s contract, agreed to on the second day of baseball’s winter meetings, contains an option for 2021 that, if it becomes guaranteed, would make the deal worth $170 million over seven seasons. The average annual value of $25.8 million is the second-highest for a pitcher behind Clayton Kershaw’s $30.7 million as part of a $215 million, seven-year deal with the Los Angeles Dodgers that began this year.

A three-time All-Star, Lester turns 31 next month. The left-hander, who won two World Series titles with Boston, joins a team with a promising core of young players and a top-tier manager in Joe Maddon. Now, Chicago has an ace to lead the rotation as it tries to end a run of five straight losing seasons and a championship drought that dates to 1908.

Lester was dealt by the Red Sox to Oakland at the trade deadline in July and helped the A’s reach the playoffs for the third straight year before a 9-8, 12-inning loss to Kansas City in the AL wild-card game. He went 16-11 with a career-best 2.46 ERA and 220 strikeouts last season and is 116-67 with a 3.58 ERA in nine big league seasons.

Lester is headed to a team that hasn’t made the playoffs since 2008, but he knows Cubs president of baseball operations Theo Epstein and general manager Jed Hoyer from their time together in Boston.