The Red Sox overcame a two-run deficit in the late innings to maintain a lead of 2 1/2 games over Boston in the American League East. It was Boston's fourth straight win.
Boston trailed 3-1 heading into the seventh, but the Red Sox put runners on second and third with two away and Dustin Pedroia came through with a single to left on the first pitch he saw from reliever Francisco Rodriguez.
Brian Matusz came on for Baltimore in the eighth and struck out the only two men he faced. Tommy Hunter (3-3) replaced Matusz and gave up a double to Jarrod Saltalamacchia. Stephen Drew was then intentionally walked and Carp put the Red Sox in front with his base hit to left.
Baltimore has dropped two in a row to fall five games out of the second wild card berth in the American League.
Teacher apologizes for showing sexual image of herself in class
Interpol investigating stolen passports on missing flight