A source told ESPN's Buster Olney that the total value of the contract is $32 million. The team has yet to confirm the deal, which is contingent on Lackey's passing a physical.
In signing Lackey, the Cubs forfeit their first-round pick because he was given a qualifying offer by the Cardinals before departing via free agency.
Fox Sports first reported the signing.
Cubs president of baseball operations Theo Epstein "guessed" earlier on Friday that his team would sign a free-agent pitcher and also trade for one this offseason.
The agreement with Lackey presumably ends any conversations Chicago was having with former Cub Jeff Samardzija, whom Epstein said Friday the team was in "dialogue" with. Sources told ESPN.com's Jayson Stark that the bidding for Samardzija might have gone higher than the Cubs were comfortable with.
Lackey, 37, had a 2.77 ERA in 33 starts last season for the St. Louis Cardinals, throwing 218 innings and allowing 211 hits and 53 walks. He shut out the Cubs over 7 innings in Game 1 of the division series and then, pitching on three days' rest, took a no-decision in Chicago's series-ending Game 4 victory.
In 2015, Lackey threw his most innings in a season since 2007 and passed the 200-inning milestone for the first time since undergoing Tommy John surgery and missing all of 2012.
Lackey made $507,500 last season because of a clause in his previous contract with the Red Sox. In signing the two-year, $32 million deal, his average annual value will be 31.5 times larger than it was in 2015.
Lackey figures to slide into the No. 3 spot in the rotation behind Cy Young Award winner Jake Arrieta and Jon Lester. Righties Jason Hammel and Kyle Hendricks would occupy the Nos. 4 and 5 spots, pending other deals by the Cubs.
"One of the best competitors I've ever been around, and I'm not just saying that," Ross said Friday afternoon. "He's going to bring a toughness to our team that is going to make everybody better."
Cubs manager Joe Maddon was on the coaching staff with theLos Angeles Angelswhen Lackey broke into the league in 2002 and won his first World Series ring.
ESPN Stats & Information contributed to this report.