San Francisco Giants' Gorkys Hernandez, reacts with teammate Nick Hundley, left, after scoring off a three-RBI double by Chris Stratton during the second inning of a baseball game against the San Diego Padres in San Diego, Sept. 19, 2018,. Credit: Gregory Bull | AP

Free agent outfielder Gorkys Hernandez and the Boston Red Sox have reached agreement on a minor league contract.

The deal Wednesday includes a spring training invite to big league camp with the World Series champions.

The 31-year-old Hernandez hit 15 home runs last season while batting .234 with 40 RBIs in 142 games for San Francisco. In 2017, he didn’t hit a homer in 310 at-bats.

The Giants recently opted not to offer Hernandez a contract for 2019. New Giants president of baseball operations Farhan Zaidi said earlier this week at the winter meetings that his club was looking for an improved combination of on-base percentage and power in the outfield positions.

Hernandez has previously played for Pittsburgh and Miami.