Lester's contract, agreed to on the second day of MLB'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.
"It's not often you get to win the lottery, and we won the baseball lottery this year," new Cubs manager Joe Maddon said. "Now it's up to us to put it into effect."
A three-time All-Star who turns 31 next month, Lester won two World Series with Boston. The left-hander joins a long-suffering team with a promising core of young players and a top-tier manager, Maddon, who left Tampa Bay and signed a $25 million, five-year contract with the Cubs.
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 American League 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.
He also had been sought by the Red Sox, World Series champion San Francisco and the Los Angeles Dodgers.