PHILADELPHIA — Freddy Galvis and the Philadelphia Phillies have agreed to a $4.35 million, one-year contract and avoided salary arbitration.

In his second full season as Philadelphia’s starting shortstop, Galvis had a career-high 20 homers and 67 RBIs in 2016, when he made $2 million. He also was an NL Gold Glove finalist. But the switch-hitting Galvis batted only .241 with a .274 on-base percentage. He had 17 stolen bases.

Galvis is eligible for free agency after the 2018 season.

The deal was completed Thursday. Two Phillies remain eligible for arbitration and were set to swap proposed salaries with the team Friday barring agreements: right-hander Jeanmar Gomez and second baseman Cesar Hernandez.