Right-handed reliever Edward Mujica was acquired by the Cardinals, who sent third baseman Zack Cox to the Marlins, the teams announced.
Mujica, 28, has a 4.38 ERA in 39 innings this season. He came to Miami along with outfielder Cameron Maybin in a deal with San Diego in 2010. Mujica missed two weeks during the first half of July recovering from a broken toe on his right foot.
Cox, 23, is batting .254 for Class AAA this season. He was St. Louis' first-round pick in 2010 and was ranked fourth among the organization's prospects by Baseball America before the start of the season.