The Marlins, seeking to upgrade their production at first base, acquired Carlos Lee from the Astros on Wednesday.
The Astros receive two minor leaguers, third baseman Matt Dominguez and pitcher Rob Rasmussen.
As part of the deal, the Astros will cover all of the approximately $9 million remaining on Lee's contract except for a pro-rated portion of the minimum salary.
Lee, 36, had the right to block trades to 14 teams as part of his limited no-trade protection and rejected a deal to the Dodgers last week. The Marlins were not one of the teams he could block, a source said.
Lee will take over first for former All-Star Gaby Sanchez, who recently spent three weeks at Triple A and has batted only .190 with a .489 OPS since rejoining the team on June 10.
The Marlins rank last in the majors at OPS at first base. Lee, who last week rejected a trade to the Dodgers, is batting .286 with a .748 OPS and five home runs in 274 at-bats.
ESPN.com first reported that the trade was imminent.