
The win was only the fifth since Wimbledon for the 72nd-ranked American, a Madrid qualifier whose form has taken a dive in recent seasons.
Federer, playing on the ATP for the first time since winning a fourth consecutive US Open title in September, then failing to save Switzerland in Davis Cup relegation, owns a 3-0 record over Ginepri.
Their last meeting was a quarter-final here a year ago which the Swiss swept in straight sets.
Argentine Juan Monaco also produced a comeback effort to start the penultimate Masters event of the season, with the race for the eight-man Masters Cup in Shanghai tightening with three weeks of ATP play remaining.
Monaco recovered to defeat Russian Igor Andreev 6-7 (5-7), 6-0, 6-4. Argentine Juan Del Potro also reached the second round, eliminating Italian Potito Starace 7-5, 6-1.
The South American next plays German Tommy Haas, the 11th seed, who stands eighth in the race to the season wrapup thanks to a Stockholm semi-final at the weekend.
Stefan Koubek knocked out Jarkko Nieminen four days after the Finn reached the Stockholm quarter-finals, with the Austrian earning a 6-3, 3-6, 6-4 victory.
Russian Nikolay Davydenko, seeded fourth, became the fought man to clinch a place in China alongside Federer, Rafael Nadal and Novak Djokovic, the weekend Vienna champion.