Federer, who dropped his serve twice, missed seven chances to break Gimeno-Traver for a second time in the second set. But the Swiss star saved four breaks points on his opening service game of the deciding set.
Meanwhile, second-seeded Grigor Dimitrov of Bulgaria advanced to the semis with a 6-4, 6-3 win against Croatia's Ivan Dodig, and will play third-seeded Pablo Cuevas of Uruguay. He beat Thomaz Bellucci 7-5, 6-3, breaking the Brazilian's serve twice in each set.
Federer, who trailed 5-2 in the second set, was not at his best. But he picked up his game when it mattered, rallying from 40-15 down in the eighth game to break Gimeno-Traver for 5-3 and then served out the match.
The 17-time Grand Slam champion, who needed 2 hours, 28 minutes to win, next faces eighth-seeded Diego Schwartzman of Argentina, who beat fourth-seeded Santiago Giraldo of Colombia 0-6, 6-2, 6-2.
While Federer is chasing his 85th career title and third this year, Schwartzman reached his first career semifinal, despite winning just seven points in the entire first set and trailing 2-0 in the second set.
''I lost the first eight games. He started really well and maybe I was a little nervous,'' Schwartzman said. ''The crowd was amazing for me, I hope tomorrow will be the same.''