The Giants and Red Sox went throwback in their fashions at Fenway Wednesday night. Hanley Ramirez sent Giants outfielders back, back, back.

The shortstop-turned-outfielder-first baseman launched three two-run homers while wearing a ’70s-style pullover. He sent Mac Williamson flipping over the bullpen wall in an orange pullover on his first homer in the second inning. A third inning shot traveled more than 400 feet to center. He propelled a third dinger over the green monster in the sixth.

The Giants, powered by Williamson and Trevor Brown round trippers, clawed back from an 8-0 deficit to make it 8-7. But the red-capped Red Sox added three more runs to defeat San Francisco in a rare visit to Fenway Park.

Ramirez’s teammates encouraged him to become the 17th player to hit four homers in a game. But he says he doesn’t hit four-baggers when he seeks them.

‘‘I don’t hit homers when I try to hit homers,’’ he told reporters. ‘‘They said, ‘It doesn’t matter. You’ve got three already.’’’

With the crowd chanting his name, Ramirez grounded out to the pitcher to finish the game 3-for-4 with six RBI.