In exchange, the Cardinals received minor league shortstop Rayder Ascanio, international cap space totaling $750,000 and cash considerations.
"Mike gives us an experienced starter that will help us as we navigate our way towards a playoff spot this season," Mariners president and general manager Jerry Dipoto said in a statement. "As one of the most durable starters over most of the last decade, he'll be a valuable addition for not just the near future, but for seasons to come."
Leake will join a Seattle rotation that has struggled to produce quality outings over the past month while dealing with injuries to James Paxton and Felix Hernandez. Leake is 7-12 with a 4.21 ERA and is a proven veteran to add to Seattle's rotation. But he has struggled since the All-Star break, going 1-5 with a 6.90 ERA in nine starts since July 14.
"His first 10 starts were spectacular. Obviously his last 10 have not been great for him," Dipoto said. "Like a lot of guys you go through highs and lows through a season and in Mike's case we're going to bet on the big picture."
Dipoto said the plan is for Leake to make his first start for Seattle sometime this weekend when the club returns home to play Oakland.
"As soon as it was OK to let the guys know this morning, I think the reaction was very, very positive," Seattle manager Scott Servais said. "They kind of know what we're up against. And anybody that can come in and get a little bit deeper in the ballgame for us but does have experience is really, really big."
Leake is under contract through the 2020 season with an option for 2021. He signed an $80 million, five-year deal before the 2016 season.
The Cardinals are kicking in about $17 million in the trade to help offset the salary owned to Leake over the next three years, sources told ESPN's Buster Olney.
"The contribution the Cardinals made was both significant and made us feel good about the price point," Dipoto said. "And the way we viewed it is if Mike Leake is a 30-year-old free agent and we were able to achieve this deal with him we would feel comfortable signing him to that contract. It was a real consideration and a strong factor in what led us to doing this deal."
The trade comes before Thursday's deadline for major league teams to acquire a player and have him be eligible for the postseason.
The Mariners (66-68) are 3½ games out of the second wild-card spot in the American League after being swept in Baltimore to conclude a 5-7 road trip. The Cardinals (66-65) are 5½ games out in the National League wild-card race.
In eight seasons, Leake has a career mark of 80-76 with a 4.02 ERA. He also has pitched for the Reds and Giants.
Ascanio, 21, was hitting a combined .217 with nine home runs and 44 RBIs between stops at Class A Modesto, Double-A Clinton and Triple-A Tacoma.
It is the second trade involving the Mariners and Cardinals this summer. Seattle previously traded for left-hander Marco Gonzales.
The Associated Press contributed to this report.