Ramírez was signed by the Texas Rangers in 1996, as an infielder. After one season in their minor leagues, he was released. He spent the next three years learning how to pitch before joining the Hiroshima Toyo Carp's Dominican academy in 2000. He pitched in two games with the Carp in 2002 and was signed by the New York Yankees in 2003. He spent 2.5 years in their minor leagues before getting traded to the Colorado Rockies in the middle of the 2005 season. Shortly after the 2006 season started, Ramírez was called up by the Rockies, and he went on to have a successful rookie season for them. In 2007, he had an 8.31 ERA with the Rockies and spent time on the disabled list and in the minor leagues. Before the 2008 season, he was traded to the Kansas City Royals. After one season with the Royals, he was traded to the Boston Red Sox. In 2009, his seven wins were tied for third among relief pitchers in the American League. After an inconsistent start to the 2010 season, Ramírez was traded to the San Francisco Giants. He posted a 0.67 ERA with the Giants, helping them reach the playoffs. He gave up runs in 4 of the 5 playoff games he pitched in, but the Giants won their first World Series since 1954. In 2011, Ramírez posted a career-best 2.62 ERA and was traded to the New York Mets after the season.