The Marlins picked up right-handed starter Merandy Gonzalez and center fielder Ricardo Cespedes in the deal that was announced by Marlins president of baseball operations Michael Hill.
Ramos was 2-4 with 20 saves, a 3.63 ERA and 47 strikeouts in 40 games for the Marlins this season. He has a career record of 15-16 with 92 saves and a 2.78 ERA in 325 games.
Considered one of the top relievers on the trade market, Ramos reportedly drew interest from the Colorado Rockies, Boston Red Sox, Tampa Bay Rays, Milwaukee Brewers, Cleveland Indians and Washington Nationals.
The 30-year-old Ramos is making $6.55 million this year and is under contract through next season.
Gonzalez, 21, has spent this season between Class A Columbia in the South Atlantic League and Class A St. Lucie in the Florida State League. He has a combined record of 12-3 with a 1.78 ERA in 17 starts. The Dominican Republic native is ranked the Mets' No. 9 prospect by MLB.com.
Cespedes, 19, has a combined .255 average in 29 games for three teams this year, including Brooklyn in the Class A New York Penn League.