Wawrinka was cruising at 4-0 up in the second set, then failed to serve out the match at 5-3 before clinching victory in the tiebreaker.
Fourth-seeded Juan Monaco of Argentina eased past Guillermo Garcia-Lopez of Spain 6-1, 6-2 under warm sunshine in the ski resort venue. Monaco will face Mikhail Youzhny of Russia on Friday, in the same half of the draw as Federer.
Youzhny, the No. 6 seed, beat his second-round opponent Pablo Andujar of Spain, 6-3, 4-6, 6-3.