The Boston Red Sox scored five runs in the ninth inning to secure a win over the St. Louis Cardinals.