Harold Ramirez had a homer and drove in two runs to help the Tampa Bay Rays beat the Pittsburgh Pirates 4-1.