The deal is worth around $52 million, a source told ESPN.com's Jim Bowden on Sunday.
The Cardinals filled a need by getting a top-hitting shortstop a month after losing the World Series in six games to Boston. Pete Kozma and Daniel Descalso, while generally good fielders, are light hitters.
"We are pleased to announce that Jhonny has agreed to terms and I know he is equally excited to be joining the Cardinals," general manager John Mozeliak said in a statement. "Jhonny is among the game's top offensive shortstops, he's a steady defender and he has experience playing for a contender. He gives us proven veteran experience and brings balance and versatility to our everyday lineup. "
But the move drew a different reaction from a couple other big leaguers.
"It pays to cheat... Thanks, owners, for encouraging PED use," Arizona pitcher Brad Ziegler tweeted.
Free agent pitcher David Aardsma also took to Twitter:
Apparently getting suspended for PED's means you get a raise. What's stopping anyone from doing it? #weneedtomakeachange— David Aardsma (@TheDA53) November 24, 2013
The 31-year-old Peralta was suspended 50 games last season as a result of Major League Baseball's investigation in the Biogenesis case involving performance-enhancing drugs. He returned to the Detroit Tigers in late September and played in the postseason, both in left field and at shortstop.
Shortly before Peralta was penalized, the Tigers acquired young shortstop Jose Iglesias from Boston in a three-team trade.
Peralta hit .303 with 11 home runs and 55 RBIs in 107 games during the regular season, then batted .333 with one homer, four doubles and six RBIs in 10 playoff games.
The two-time All-Star is a career .268 hitter with 156 homers and 698 RBIs in 11 seasons with Cleveland and Detroit.
The NL champion Cardinals have been busy since the season ended. A few days ago, they sent third baseman David Freese, a hometown product and the 2011 World Series MVP, to the Los Angeles Angels for outfielder Peter Bourjos in a four-player trade.
The Cardinals cut about $45 million off last season's payroll, and wanted to plug a hole at shortstop. St. Louis lost All-Star Rafael Furcal in spring training for the whole year because of elbow surgery.
Detroit did not extend a qualifying offer to Peralta, meaning there would be no compensation draft pick involved in his move from the AL Central champions to the NL Central winners.
Information from The Associated Press was used in this report.