PHILADELPHIA -- The Phillies have avoided salary arbitration with shortstop Freddy Galvis and right-hander Jeanmar Gomez .

They still have a chance to avoid salary arbitration with second baseman Cesar Hernandez .

The Phillies on Friday announced they had agreed to terms on one-year contracts with Galvis ($4.35 million) and Gomez ($4.2 million). They also exchanged salary arbitration figures with Hernandez, who filed for $2.8 million. The Phillies countered at $2 million. MLB Trade Rumors estimated Hernandez could earn $2.5 million in salary arbitration.

Gomez, 28, unexpectedly became the Phillies' closer last season. He went 3-5 with a 4.85 ERA and 37 saves in 70 appearances. He had a 2.52 ERA and 30 saves in 33 opportunities in 51 appearances through Aug. 13, but he had a 13.20 ERA and seven saves in 10 opportunities in his final 19 appearances. He lost his job as closer in the final week of the season.

Gomez could be a middle reliever in 2017, with Hector Neris or Joaquin Benoit possibilities to close.

MLB.com reported Thursday that the Phillies and Galvis had reached an agreement. Galvis, 27, hit .241 with 26 doubles, three triples, 20 home runs, 67 RBIs and a .673 OPS in 624 plate appearances last year. He also played Gold Glove Award-caliber defense at shortstop. According to FanGraphs, Galvis ranked third among all big league shortstops in DEF (Defensive Runs Above Average).

Hernandez, 26, hit .294 with 14 doubles, 11 triples, six home runs, 39 RBIs and a .764 OPS in 622 plate appearances. His .371 on-base percentage ranked 22nd out of 146 qualified hitters in baseball. (Galvis' .274 on-base percentage ranked last.)

The Phillies and Hernandez can come to an agreement before they reach an arbitration session, which would be scheduled sometime between Jan. 30 and Feb. 17 in St. Petersburg, Fla.

Todd Zolecki has covered the Phillies since 2003, and for MLB.com since 2009. Follow him on Twitter and listen to his podcast.